Bugzilla – Attachment 1076 Details for
Bug 1159
%u and %h not handled in IdentityFile
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
User-dependent IdentityFile
openssh-IdentityFile.patch (text/plain), 3.51 KB, created by
John Bowman
on 2006-02-22 16:41:30 AEDT
(
hide
)
Description:
User-dependent IdentityFile
Filename:
MIME Type:
Creator:
John Bowman
Created:
2006-02-22 16:41:30 AEDT
Size:
3.51 KB
patch
obsolete
>diff -ru openssh-4.3p2/Makefile.in openssh-4.3p2J/Makefile.in >--- openssh-4.3p2/Makefile.in 2006-01-01 01:47:05.000000000 -0700 >+++ openssh-4.3p2J/Makefile.in 2006-02-21 00:45:37.000000000 -0700 >@@ -148,7 +148,7 @@ > $(LD) -o $@ ssh-agent.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) > > ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o >- $(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) >+ $(LD) -o $@ ssh-keygen.o readconf.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) > > ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o > $(LD) -o $@ ssh-keysign.o readconf.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) >diff -ru openssh-4.3p2/ssh-keygen.c openssh-4.3p2J/ssh-keygen.c >--- openssh-4.3p2/ssh-keygen.c 2005-11-28 19:10:25.000000000 -0700 >+++ openssh-4.3p2J/ssh-keygen.c 2006-02-21 00:45:37.000000000 -0700 >@@ -26,6 +26,8 @@ > #include "bufaux.h" > #include "pathnames.h" > #include "log.h" >+#include "ssh.h" >+#include "readconf.h" > #include "misc.h" > #include "match.h" > #include "hostfile.h" >@@ -95,6 +97,13 @@ > int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *); > int prime_test(FILE *, FILE *, u_int32_t, u_int32_t); > >+/* >+ * General data structure for command line options and options configurable >+ * in configuration files. See readconf.h. >+ */ >+Options options; >+uid_t original_real_uid; >+ > static void > ask_filename(struct passwd *pw, const char *prompt) > { >@@ -120,7 +129,29 @@ > break; > } > >- snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir, name); >+ >+ if(options.num_identity_files > 0) { >+ char *file=NULL; >+ char *p=strrchr(name,'/'); >+ if(p) file = p+1; >+ >+ name = tilde_expand_filename(options.identity_files[0], >+ original_real_uid); >+ name = percent_expand(name, "h", pw->pw_dir, >+ "u", pw->pw_name, (char *)NULL); >+ p=strrchr(name,'/'); >+ if(p) *p=0; >+ >+ if(file && *file) { >+ snprintf(identity_file, sizeof(identity_file), "%s/%s", name,file); >+ } >+ else { >+ snprintf(identity_file, sizeof(identity_file), "%s", name); >+ } >+ } else { >+ snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir, >+ name); >+ } > fprintf(stderr, "%s (%s): ", prompt, identity_file); > if (fgets(buf, sizeof(buf), stdin) == NULL) > exit(1); >@@ -1015,6 +1046,7 @@ > int log_level = SYSLOG_LEVEL_INFO; > BIGNUM *start = NULL; > FILE *f; >+ char buf[256]; > const char *errstr; > > extern int optind; >@@ -1042,6 +1074,13 @@ > exit(1); > } > >+ snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir, >+ _PATH_SSH_USER_CONFFILE); >+ (void)read_config_file(buf, hostname, &options, 1); >+ >+ /* Read systemwide configuration file after user config. */ >+ (void)read_config_file(_PATH_HOST_CONFIG_FILE, hostname, &options, 0); >+ > while ((opt = getopt(ac, av, > "degiqpclBHvxXyF:b:f:t:U:D:P:N:C:r:g:R:T:G:M:S:a:W:")) != -1) { > switch (opt) { >diff -ru openssh-4.3p2/ssh.c openssh-4.3p2J/ssh.c >--- openssh-4.3p2/ssh.c 2005-12-30 22:33:37.000000000 -0700 >+++ openssh-4.3p2J/ssh.c 2006-02-21 00:45:37.000000000 -0700 >@@ -1202,9 +1202,14 @@ > xfree(keys); > } > #endif /* SMARTCARD */ >+ struct passwd *pw; >+ pw=getpwuid(original_real_uid); >+ if (!pw) fatal("Unknown user id: %d", original_real_uid); > for (; i < options.num_identity_files; i++) { > filename = tilde_expand_filename(options.identity_files[i], > original_real_uid); >+ filename = percent_expand(filename, "h", pw->pw_dir, >+ "u", pw->pw_name, (char *)NULL); > public = key_load_public(filename, NULL); > debug("identity file %s type %d", filename, > public ? public->type : -1);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1159
:
1076
|
1077
|
1083
|
1097