From: Danilo Almeida Date: Tue, 10 Aug 1999 00:19:25 +0000 (+0000) Subject: Build kpasswd under windows X-Git-Tag: krb5-1.2-beta1~308 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f5a39a403b154f07fe8a0c1f56903ecfc96d31c7;p=krb5.git Build kpasswd under windows git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11636 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/ChangeLog b/src/ChangeLog index 2eab397b1..05ab21b14 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +1999-08-09 Danilo Almeida + + * Makefile.in: Build kpasswd under windows. + 1999-07-22 Tom Yu * Makefile.in (install-mkdirs): Use mkinstalldirs rather than diff --git a/src/Makefile.in b/src/Makefile.in index d4aba1439..664a99acf 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -131,6 +131,7 @@ config-windows:: Makefile-windows WINMAKEFILES=Makefile \ clients\Makefile clients\kdestroy\Makefile \ clients\kinit\Makefile clients\klist\Makefile \ + clients\kpasswd\Makefile \ include\Makefile include\krb5\Makefile \ lib\Makefile lib\crypto\Makefile \ lib\crypto\crc32\Makefile lib\crypto\des\Makefile \ @@ -175,6 +176,8 @@ WINMAKEFILES=Makefile \ ##DOS## $(WCONFIG) config < $@.in > $@ ##DOS##clients\klist\Makefile: clients\klist\Makefile.in $(MKFDEP) ##DOS## $(WCONFIG) config < $@.in > $@ +##DOS##clients\kpasswd\Makefile: clients\kpasswd\Makefile.in $(MKFDEP) +##DOS## $(WCONFIG) config < $@.in > $@ ##DOS##include\Makefile: include\Makefile.in $(MKFDEP) ##DOS## $(WCONFIG) config < $@.in > $@ ##DOS##include\krb5\Makefile: include\krb5\Makefile.in $(MKFDEP) @@ -300,6 +303,7 @@ ren2long: ZIP=zip FILES= ./* \ clients/* clients/kdestroy/* clients/kinit/* clients/klist/* \ + clients/kpasswd/* \ config/* include/* include/kerberosIV/* \ include/krb5/* include/krb5/stock/* include/sys/* lib/* \ lib/crypto/* lib/crypto/crc32/* lib/crypto/des/* lib/crypto/dk/* \ @@ -520,3 +524,4 @@ mkbin: $(CP) clients\klist\$(OUTPRE)klist.exe $(KBINDIR)\. $(CP) clients\kinit\$(OUTPRE)kinit.exe $(KBINDIR)\. $(CP) clients\kdestroy\$(OUTPRE)kdestroy.exe $(KBINDIR)\. + $(CP) clients\kpasswd\$(OUTPRE)kpasswd.exe $(KBINDIR)\. diff --git a/src/clients/ChangeLog b/src/clients/ChangeLog index 7aa79e60a..84c16224b 100644 --- a/src/clients/ChangeLog +++ b/src/clients/ChangeLog @@ -1,3 +1,7 @@ +1999-08-09 Danilo Almeida + + * Makefile.in: Build kpasswd under windows. + Tue May 18 19:52:56 1999 Danilo Almeida * Makefile.in: Remove - from recursive Win32 make invocation. diff --git a/src/clients/Makefile.in b/src/clients/Makefile.in index ada6fd0c1..931bdc0c9 100644 --- a/src/clients/Makefile.in +++ b/src/clients/Makefile.in @@ -16,6 +16,9 @@ all-windows:: @echo Making all in clients\kinit cd ..\kinit $(MAKE) -$(MFLAGS) + @echo Making all in clients\kpasswd + cd ..\kpasswd + $(MAKE) -$(MFLAGS) cd .. clean-windows:: diff --git a/src/clients/kpasswd/ChangeLog b/src/clients/kpasswd/ChangeLog index 46f98c554..c61e68898 100644 --- a/src/clients/kpasswd/ChangeLog +++ b/src/clients/kpasswd/ChangeLog @@ -1,3 +1,8 @@ +1999-08-09 Danilo Almeida + + * kpasswd.c: + * Makefile.in: Build kpasswd under windows. + 1998-11-13 Theodore Ts'o * 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 2b7490820..dddc05b95 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 711c4ecd6..2e719d6de 100644 --- a/src/clients/kpasswd/kpasswd.c +++ b/src/clients/kpasswd/kpasswd.c @@ -1,20 +1,51 @@ #include #include -#include + +#ifndef _WIN32 #include +#endif #include #define P1 "Enter new password: " #define P2 "Enter it again: " +#ifdef HAVE_PWD_H +#include + +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);