[BACK]Return to skeyinfo.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / skeyinfo

Diff for /src/usr.bin/skeyinfo/skeyinfo.c between version 1.8 and 1.9

version 1.8, 2001/06/17 22:54:44 version 1.9, 2001/06/19 01:49:45
Line 38 
Line 38 
   
 extern char *__progname;  extern char *__progname;
   
 void usage __P((void));  void usage(void);
   
 int  int
 main(argc, argv)  main(int argc, char **argv)
         int argc;  
         char **argv;  
 {  {
         struct passwd *pw;          struct passwd *pw;
         char *challenge, *cp, *name = NULL;          char *style, *challenge, *cp, *name;
         int ch, verbose = 0;          int ch, verbose = 0;
           login_cap_t *lc;
         auth_session_t *as;          auth_session_t *as;
   
         while ((ch = getopt(argc, argv, "v")) != -1)          name = NULL;
           style = "skey";
           while ((ch = getopt(argc, argv, "a:v")) != -1)
                 switch(ch) {                  switch(ch) {
                   case 'a':
                           style = optarg;
                           break;
                 case 'v':                  case 'v':
                         verbose = 1;                          verbose = 1;
                         break;                          break;
Line 80 
Line 84 
         if ((name = strdup(pw->pw_name)) == NULL)          if ((name = strdup(pw->pw_name)) == NULL)
                 err(1, "cannot allocate memory");                  err(1, "cannot allocate memory");
   
         as = auth_userchallenge(name, "skey", NULL, &challenge);          if ((lc = login_getclass(pw->pw_class)) == NULL)
                   errx(1, "unable to classify user %s", name);
   
           if ((cp = login_getstyle(lc, style, NULL)) == NULL)
                   errx(1, "unknown authentication method %s", style);
   
           as = auth_userchallenge(name, cp, NULL, &challenge);
         if (as == NULL || challenge == NULL) {          if (as == NULL || challenge == NULL) {
                 if (as)                  if (as)
                         auth_close(as);                          auth_close(as);
                 errx(1, "unable to retrieve S/Key challenge for %s", name);                  errx(1, "unable to retrieve challenge for %s", name);
         }          }
   
         /*          /*
Line 107 
Line 117 
 }  }
   
 void  void
 usage()  usage(void)
 {  {
         (void)fprintf(stderr, "Usage: %s [-v] [user]\n", __progname);  
           (void)fprintf(stderr, "Usage: %s [-a auth-type] [-v] [user]\n",
               __progname);
         exit(1);          exit(1);
 }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9