Bugzilla – Attachment 70 Details for
Bug 212
Add netgroup support to ssh-keyscan
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
netgroups patch against cvs
keyscan.patch (text/plain), 3.98 KB, created by
James A. Morrison
on 2002-04-11 02:48:29 AEST
(
hide
)
Description:
netgroups patch against cvs
Filename:
MIME Type:
Creator:
James A. Morrison
Created:
2002-04-11 02:48:29 AEST
Size:
3.98 KB
patch
obsolete
>? build >? keyscan.patch >? netgroups.patch >? showattachment.cgi?attach_id=69 >Index: ssh-keyscan.1 >=================================================================== >RCS file: /cvs/openssh/ssh-keyscan.1,v >retrieving revision 1.14 >diff -u -p -r1.14 ssh-keyscan.1 >--- ssh-keyscan.1 19 Feb 2002 04:19:43 -0000 1.14 >+++ ssh-keyscan.1 10 Apr 2002 16:39:40 -0000 >@@ -19,6 +19,7 @@ > .Op Fl T Ar timeout > .Op Fl t Ar type > .Op Fl f Ar file >+.Op Fl n Ar netgroup > .Op Ar host | addrlist namelist > .Op Ar ... > .Sh DESCRIPTION >@@ -73,6 +74,10 @@ is supplied instead of a filename, > will read hosts or > .Pa addrlist namelist > pairs from the standard input. >+.It Fl n Ar netgroup >+Specifies that hostnames appear in the >+.Pa netgroup >+specified. Multiple values may be specified by separating them with commas. > .It Fl v > Verbose mode. > Causes >@@ -105,6 +110,12 @@ host key for machine > .Pa hostname : > .Bd -literal > $ ssh-keyscan hostname >+.Ed >+.Pp >+Print the version 1 and 2 RSA keys for all hosts in the servers and >+workstations netgroups >+.Bd -literal >+$ ssh-keyscan -t rsa1,rsa -n servers,workstations > .Ed > .Pp > Find all hosts from the file >Index: ssh-keyscan.c >=================================================================== >RCS file: /cvs/openssh/ssh-keyscan.c,v >retrieving revision 1.43 >diff -u -p -r1.43 ssh-keyscan.c >--- ssh-keyscan.c 5 Apr 2002 20:23:37 -0000 1.43 >+++ ssh-keyscan.c 10 Apr 2002 16:39:40 -0000 >@@ -14,6 +14,7 @@ RCSID("$OpenBSD: ssh-keyscan.c,v 1.35 20 > #include <openssl/bn.h> > > #include <setjmp.h> >+ > #include "xmalloc.h" > #include "ssh.h" > #include "ssh1.h" >@@ -386,8 +387,10 @@ tcpconnect(char *host) > memset(&hints, 0, sizeof(hints)); > hints.ai_family = IPv4or6; > hints.ai_socktype = SOCK_STREAM; >- if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) >- fatal("getaddrinfo %s: %s", host, gai_strerror(gaierr)); >+ if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) { >+ error("getaddrinfo %s: %s", host, gai_strerror(gaierr)); >+ return (-1); >+ } > for (ai = aitop; ai; ai = ai->ai_next) { > s = socket(ai->ai_family, SOCK_STREAM, 0); > if (s < 0) { >@@ -680,6 +683,7 @@ usage(void) > __progname); > fprintf(stderr, "Options:\n"); > fprintf(stderr, " -f file Read hosts or addresses from file.\n"); >+ fprintf(stderr, " -n netgroup Do all hosts or addresses from netgroup.\n"); > fprintf(stderr, " -p port Connect to the specified port.\n"); > fprintf(stderr, " -t keytype Specify the host key type.\n"); > fprintf(stderr, " -T timeout Set connection timeout.\n"); >@@ -695,6 +699,7 @@ main(int argc, char **argv) > int debug_flag = 0, log_level = SYSLOG_LEVEL_INFO; > int opt, fopt_count = 0; > char *tname; >+ char *netgroups = NULL; > > extern int optind; > extern char *optarg; >@@ -707,7 +712,7 @@ main(int argc, char **argv) > if (argc <= 1) > usage(); > >- while ((opt = getopt(argc, argv, "v46p:T:t:f:")) != -1) { >+ while ((opt = getopt(argc, argv, "v46p:T:t:f:n:")) != -1) { > switch (opt) { > case 'p': > ssh_port = a2port(optarg); >@@ -757,6 +762,9 @@ main(int argc, char **argv) > tname = strtok(NULL, ","); > } > break; >+ case 'n': >+ netgroups = xstrdup(optarg); >+ break; > case '4': > IPv4or6 = AF_INET; > break; >@@ -768,7 +776,7 @@ main(int argc, char **argv) > usage(); > } > } >- if (optind == argc && !fopt_count) >+ if (optind == argc && !fopt_count && !netgroups) > usage(); > > log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1); >@@ -788,6 +796,23 @@ main(int argc, char **argv) > read_wait_size = howmany(maxfd, NFDBITS) * sizeof(fd_mask); > read_wait = xmalloc(read_wait_size); > memset(read_wait, 0, read_wait_size); >+ >+ if (netgroups) { >+ char *machine, *user, *domain, *curng; >+ char *token = netgroups; >+ while ( (curng = strtok(token, ",")) ) { >+ if (setnetgrent(curng)) { >+ while (getnetgrent(&machine, &user, &domain)) >+ if (machine) >+ do_host(machine); >+ endnetgrent(); >+ } >+ else >+ error("%s: invalid netgroup \"%s\"", __progname, curng); >+ >+ token = NULL; >+ } >+ } > > if (fopt_count) { > Linebuf *lb;
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 212
:
69
| 70