Bugzilla – Attachment 69 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]
Add -n netgroup option to ssh-keyscan and man page
ssh-keyscan-netgroup.patch (text/plain), 4.12 KB, created by
Mike Gerdts
on 2002-04-11 00:37:40 AEST
(
hide
)
Description:
Add -n netgroup option to ssh-keyscan and man page
Filename:
MIME Type:
Creator:
Mike Gerdts
Created:
2002-04-11 00:37:40 AEST
Size:
4.12 KB
patch
obsolete
>diff -ur openssh-3.1p1-orig/ssh-keyscan.1 openssh-3.1p1/ssh-keyscan.1 >--- openssh-3.1p1-orig/ssh-keyscan.1 Mon Feb 18 23:19:43 2002 >+++ openssh-3.1p1/ssh-keyscan.1 Wed Apr 10 10:02:50 2002 >@@ -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 @@ > 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 @@ > .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 >diff -ur openssh-3.1p1-orig/ssh-keyscan.c openssh-3.1p1/ssh-keyscan.c >--- openssh-3.1p1-orig/ssh-keyscan.c Mon Mar 4 20:54:53 2002 >+++ openssh-3.1p1/ssh-keyscan.c Wed Apr 10 09:48:19 2002 >@@ -19,6 +19,7 @@ > #include <openssl/bn.h> > > #include <setjmp.h> >+ > #include "xmalloc.h" > #include "ssh.h" > #include "ssh1.h" >@@ -391,8 +392,10 @@ > 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) { >@@ -685,6 +688,7 @@ > __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"); >@@ -700,6 +704,7 @@ > 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; >@@ -712,7 +717,7 @@ > 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); >@@ -762,6 +767,12 @@ > tname = strtok(NULL, ","); > } > break; >+ case 'n': >+ netgroups = strdup(optarg); >+ if ( netgroups == NULL ) { >+ fatal("out of memory"); >+ } >+ break; > case '4': > IPv4or6 = AF_INET; > break; >@@ -773,7 +784,7 @@ > usage(); > } > } >- if (optind == argc && !fopt_count) >+ if (optind == argc && !fopt_count && !netgroups) > usage(); > > log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1); >@@ -793,6 +804,27 @@ > 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; >+ char *curng = strtok(netgroups, ","); >+ while (curng) { >+ if (setnetgrent(curng)) { >+ error("%s: invalid netgroup \"%s\"", __progname, curng); >+ continue; >+ } >+ while (getnetgrent(&machine, &user, &domain)) { >+ if ( machine == NULL ) { >+ continue; >+ } >+ do_host(machine); >+ } >+ endnetgrent(); >+ curng = strtok(NULL, ","); >+ } >+ free(netgroups); >+ netgroups = 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