[BACK]Return to auth-options.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/auth-options.c between version 1.5.2.2 and 1.5.2.3

version 1.5.2.2, 2001/02/19 17:18:33 version 1.5.2.3, 2001/03/21 19:46:22
Line 17 
Line 17 
 #include "match.h"  #include "match.h"
 #include "log.h"  #include "log.h"
 #include "canohost.h"  #include "canohost.h"
   #include "channels.h"
 #include "auth-options.h"  #include "auth-options.h"
 #include "servconf.h"  #include "servconf.h"
   
Line 51 
Line 52 
                 xfree(forced_command);                  xfree(forced_command);
                 forced_command = NULL;                  forced_command = NULL;
         }          }
           channel_clear_permitted_opens();
 }  }
   
 /*  /*
Line 61 
Line 63 
 auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)  auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
 {  {
         const char *cp;          const char *cp;
           int i;
   
         /* reset options */          /* reset options */
         auth_clear_options();          auth_clear_options();
Line 99 
Line 102 
                 }                  }
                 cp = "command=\"";                  cp = "command=\"";
                 if (strncasecmp(opts, cp, strlen(cp)) == 0) {                  if (strncasecmp(opts, cp, strlen(cp)) == 0) {
                         int i;  
                         opts += strlen(cp);                          opts += strlen(cp);
                         forced_command = xmalloc(strlen(opts) + 1);                          forced_command = xmalloc(strlen(opts) + 1);
                         i = 0;                          i = 0;
Line 118 
Line 120 
                                     file, linenum);                                      file, linenum);
                                 packet_send_debug("%.100s, line %lu: missing end quote",                                  packet_send_debug("%.100s, line %lu: missing end quote",
                                     file, linenum);                                      file, linenum);
                                 continue;                                  xfree(forced_command);
                                   forced_command = NULL;
                                   goto bad_option;
                         }                          }
                         forced_command[i] = 0;                          forced_command[i] = 0;
                         packet_send_debug("Forced command: %.900s", forced_command);                          packet_send_debug("Forced command: %.900s", forced_command);
Line 127 
Line 131 
                 }                  }
                 cp = "environment=\"";                  cp = "environment=\"";
                 if (strncasecmp(opts, cp, strlen(cp)) == 0) {                  if (strncasecmp(opts, cp, strlen(cp)) == 0) {
                         int i;  
                         char *s;                          char *s;
                         struct envstring *new_envstring;                          struct envstring *new_envstring;
   
                         opts += strlen(cp);                          opts += strlen(cp);
                         s = xmalloc(strlen(opts) + 1);                          s = xmalloc(strlen(opts) + 1);
                         i = 0;                          i = 0;
Line 148 
Line 152 
                                     file, linenum);                                      file, linenum);
                                 packet_send_debug("%.100s, line %lu: missing end quote",                                  packet_send_debug("%.100s, line %lu: missing end quote",
                                     file, linenum);                                      file, linenum);
                                 continue;                                  xfree(s);
                                   goto bad_option;
                         }                          }
                         s[i] = 0;                          s[i] = 0;
                         packet_send_debug("Adding to environment: %.900s", s);                          packet_send_debug("Adding to environment: %.900s", s);
Line 167 
Line 172 
                         const char *remote_host = get_canonical_hostname(                          const char *remote_host = get_canonical_hostname(
                             options.reverse_mapping_check);                              options.reverse_mapping_check);
                         char *patterns = xmalloc(strlen(opts) + 1);                          char *patterns = xmalloc(strlen(opts) + 1);
                         int i;  
                         opts += strlen(cp);                          opts += strlen(cp);
                         i = 0;                          i = 0;
                         while (*opts) {                          while (*opts) {
Line 185 
Line 190 
                                     file, linenum);                                      file, linenum);
                                 packet_send_debug("%.100s, line %lu: missing end quote",                                  packet_send_debug("%.100s, line %lu: missing end quote",
                                     file, linenum);                                      file, linenum);
                                 continue;                                  xfree(patterns);
                                   goto bad_option;
                         }                          }
                         patterns[i] = 0;                          patterns[i] = 0;
                         opts++;                          opts++;
Line 212 
Line 218 
                                 return 0;                                  return 0;
                         }                          }
                         /* Host name matches. */                          /* Host name matches. */
                           goto next_option;
                   }
                   cp = "permitopen=\"";
                   if (strncasecmp(opts, cp, strlen(cp)) == 0) {
                           u_short port;
                           char *c, *ep;
                           char *patterns = xmalloc(strlen(opts) + 1);
   
                           opts += strlen(cp);
                           i = 0;
                           while (*opts) {
                                   if (*opts == '"')
                                           break;
                                   if (*opts == '\\' && opts[1] == '"') {
                                           opts += 2;
                                           patterns[i++] = '"';
                                           continue;
                                   }
                                   patterns[i++] = *opts++;
                           }
                           if (!*opts) {
                                   debug("%.100s, line %lu: missing end quote",
                                       file, linenum);
                                   packet_send_debug("%.100s, line %lu: missing end quote",
                                       file, linenum);
                                   xfree(patterns);
                                   goto bad_option;
                           }
                           patterns[i] = 0;
                           opts++;
                           c = strchr(patterns, ':');
                           if (c == NULL) {
                                   debug("%.100s, line %lu: permitopen: missing colon <%.100s>",
                                       file, linenum, patterns);
                                   packet_send_debug("%.100s, line %lu: missing colon",
                                       file, linenum);
                                   xfree(patterns);
                                   goto bad_option;
                           }
                           *c = 0;
                           c++;
                           port = strtol(c, &ep, 0);
                           if (c == ep) {
                                   debug("%.100s, line %lu: permitopen: missing port <%.100s>",
                                       file, linenum, patterns);
                                   packet_send_debug("%.100s, line %lu: missing port",
                                       file, linenum);
                                   xfree(patterns);
                                   goto bad_option;
                           }
                           if (options.allow_tcp_forwarding)
                                   channel_add_permitted_opens(patterns, port);
                           xfree(patterns);
                         goto next_option;                          goto next_option;
                 }                  }
 next_option:  next_option:

Legend:
Removed from v.1.5.2.2  
changed lines
  Added in v.1.5.2.3