]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_options.c
add -advertise_ssh flag to afpd.conf, if set announce SSH tunneling capabilities.
[netatalk.git] / etc / afpd / afp_options.c
index 781dc381e71a5be471cd9a4faddabd17397906e9..ae4265282c9867e8f06ecdcb40d64c91f363972a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.30.2.2.2.4 2004-01-08 19:16:57 lenneis Exp $
+ * $Id: afp_options.c,v 1.30.2.2.2.8 2004-06-09 02:07:15 bfernhomberg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -221,6 +221,8 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         options->flags &= ~OPTION_CUSTOMICON;
     if (strstr(buf, " -icon"))
         options->flags |= OPTION_CUSTOMICON;
+    if (strstr(buf, " -advertise_ssh"))
+        options->flags |= OPTION_ANNOUNCESSH;
 
     /* passwd bits */
     if (strstr(buf, " -nosavepassword"))
@@ -435,7 +437,7 @@ int afp_options_parseline(char *buf, struct afp_options *options)
         struct in_addr inaddr;
         if (inet_aton(c, &inaddr) && (opt = strdup(c))) {
             if (!gethostbyaddr((const char *) &inaddr, sizeof(inaddr), AF_INET))
-                LOG(log_info, logtype_afpd, "WARNING: can't find %s\n", opt);
+                LOG(log_info, logtype_afpd, "WARNING: can't find %s", opt);
             options->ipaddr = opt;
         }
     }
@@ -470,23 +472,31 @@ int afp_options_parseline(char *buf, struct afp_options *options)
             if ((opt = strdup(c)))
                 options->fqdn = opt;
         }
+       else {
+            LOG(log_error, logtype_afpd, "error parsing -fqdn, gethostbyname failed for: %s", c);
+       }
     }
 
     if ((c = getoption(buf, "-unixcodepage"))) {
-       options->unixcodepage = c;
-       if ( 0 == ( options->unixcharset = add_charset(options->unixcodepage)) ) {
-               options->unixcodepage= "LOCALE";
-               options->unixcharset = CH_UNIX;
+       if ((charset_t)-1  == ( options->unixcharset = add_charset(c)) ) {
+            options->unixcharset = CH_UNIX;
+            LOG(log_warning, logtype_afpd, "setting Unix codepage to '%s' failed", c);
        }
+       else {
+            if ((opt = strdup(c)))
+                options->unixcodepage = opt;
+       }
     }
        
     if ((c = getoption(buf, "-maccodepage"))) {
-       options->maccodepage = c;
-       if ( 0 == ( options->maccharset = add_charset(options->maccodepage)) ) {
-               options->maccodepage= "Mac_Roman";
-               options->maccharset = CH_MAC;
+       if ((charset_t)-1 == ( options->maccharset = add_charset(c)) ) {
+            options->maccharset = CH_MAC;
+            LOG(log_warning, logtype_afpd, "setting Mac codepage to '%s' failed", c);
        }
-       LOG(log_debug, logtype_afpd, "Setting Mac Codepage to '%s'", options->maccodepage);
+       else {
+            if ((opt = strdup(c)))
+                options->maccodepage = opt;
+       }
     }
 
     return 1;