diff options
author | Danilo Almeida <dalmeida@mit.edu> | 1999-08-10 00:19:25 +0000 |
---|---|---|
committer | Danilo Almeida <dalmeida@mit.edu> | 1999-08-10 00:19:25 +0000 |
commit | f5a39a403b154f07fe8a0c1f56903ecfc96d31c7 (patch) | |
tree | a616a75cc4196de597ae00080dd6a8fd8fe6b45f /src/clients/kpasswd | |
parent | d3a0f7ef51f2f52ba076e1451c2cebea7051875b (diff) | |
download | krb5-f5a39a403b154f07fe8a0c1f56903ecfc96d31c7.zip krb5-f5a39a403b154f07fe8a0c1f56903ecfc96d31c7.tar.gz krb5-f5a39a403b154f07fe8a0c1f56903ecfc96d31c7.tar.bz2 |
Build kpasswd under windows
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11636 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/clients/kpasswd')
-rw-r--r-- | src/clients/kpasswd/ChangeLog | 5 | ||||
-rw-r--r-- | src/clients/kpasswd/Makefile.in | 12 | ||||
-rw-r--r-- | src/clients/kpasswd/kpasswd.c | 46 |
3 files changed, 47 insertions, 16 deletions
diff --git a/src/clients/kpasswd/ChangeLog b/src/clients/kpasswd/ChangeLog index 46f98c5..c61e688 100644 --- a/src/clients/kpasswd/ChangeLog +++ b/src/clients/kpasswd/ChangeLog @@ -1,3 +1,8 @@ +1999-08-09 Danilo Almeida <dalmeida@mit.edu> + + * kpasswd.c: + * Makefile.in: Build kpasswd under windows. + 1998-11-13 Theodore Ts'o <tytso@rsts-11.mit.edu> * Makefile.in: Set the myfulldir and mydir variables (which are diff --git a/src/clients/kpasswd/Makefile.in b/src/clients/kpasswd/Makefile.in index 2b74908..dddc05b 100644 --- a/src/clients/kpasswd/Makefile.in +++ b/src/clients/kpasswd/Makefile.in @@ -14,17 +14,17 @@ kpasswd: kpasswd.o $(KRB5_BASE_DEPLIBS) kpasswd.o: $(srcdir)/kpasswd.c all-unix:: kpasswd -all-windows:: kpasswd.exe clean-unix:: $(RM) kpasswd.o kpasswd -clean-windows:: - $(RM) kpasswd.obj kpasswd.exe - install-all install-kdc install-server install-client install-unix:: $(INSTALL_PROGRAM) kpasswd $(DESTDIR)$(CLIENT_BINDIR)/`echo kpasswd|sed '$(transform)'` $(INSTALL_DATA) $(srcdir)/kpasswd.M $(DESTDIR)$(CLIENT_MANDIR)/`echo kpasswd|sed '$(transform)'`.1; -kpasswd.exe: kpasswd.obj - link /out:kpasswd.exe kpasswd.obj $(BUILDTOP)\lib\libkrb5.lib +##WIN32##INCLUDES = /I$(BUILDTOP)\include /I$(BUILDTOP)\include\krb5 +##WIN32##CFLAGS = $(CCOPTS2) $(INCLUDES) + +##WIN32##all-windows:: $(OUTPRE)kpasswd.exe +##WIN32##$(OUTPRE)kpasswd.exe: $(OUTPRE)kpasswd.obj $(KLIB) $(CLIB) +##WIN32## link $(LINKOPTS2) -out:$@ $** diff --git a/src/clients/kpasswd/kpasswd.c b/src/clients/kpasswd/kpasswd.c index 711c4ec..2e719d6 100644 --- a/src/clients/kpasswd/kpasswd.c +++ b/src/clients/kpasswd/kpasswd.c @@ -1,20 +1,51 @@ #include <stdio.h> #include <sys/types.h> -#include <pwd.h> + +#ifndef _WIN32 #include <unistd.h> +#endif #include <krb5.h> #define P1 "Enter new password: " #define P2 "Enter it again: " +#ifdef HAVE_PWD_H +#include <pwd.h> + +void get_name_from_passwd_file(program_name, kcontext, me) + char * program_name; + krb5_context kcontext; + krb5_principal * me; +{ + struct passwd *pw; + krb5_error_code code; + if (pw = getpwuid((int) getuid())) { + if ((code = krb5_parse_name(kcontext, pw->pw_name, me))) { + com_err (program_name, code, "when parsing name %s", pw->pw_name); + exit(1); + } + } else { + fprintf(stderr, "Unable to identify user from password file\n"); + exit(1); + } +} +#else /* HAVE_PWD_H */ +void get_name_from_passwd_file(kcontext, me) + krb5_context kcontext; + krb5_principal * me; +{ + fprintf(stderr, "Unable to identify user\n"); + exit(1); +} +#endif /* HAVE_PWD_H */ + int main(int argc, char *argv[]) { krb5_error_code ret; krb5_context context; krb5_principal princ; char *pname; - struct passwd *pwd; krb5_ccache ccache; krb5_get_init_creds_opt opts; krb5_creds creds; @@ -40,7 +71,9 @@ int main(int argc, char *argv[]) exit(1); } +#if 0 krb5_init_ets(context); +#endif /* in order, use the first of: - a name specified on the command line @@ -70,15 +103,8 @@ int main(int argc, char *argv[]) com_err(argv[0], ret, "closing ccache"); exit(1); } - } else if (pwd = getpwuid(getuid())) { - if (ret = krb5_parse_name(context, pwd->pw_name, &princ)) { - com_err(argv[0], ret, "parsing client name"); - exit(1); - } } else { - com_err(argv[0], 0, - "no matching password entry while looking for username"); - exit(1); + get_name_from_passwd_file(argv[0], context, &princ); } krb5_get_init_creds_opt_init(&opts); |