]> arthur.barton.de Git - netatalk.git/commitdiff
add -advertise_ssh flag to afpd.conf, if set announce SSH tunneling capabilities.
authorbfernhomberg <bfernhomberg>
Wed, 9 Jun 2004 02:07:15 +0000 (02:07 +0000)
committerbfernhomberg <bfernhomberg>
Wed, 9 Jun 2004 02:07:15 +0000 (02:07 +0000)
etc/afpd/afp_options.c
etc/afpd/globals.h
etc/afpd/status.c

index cad72ee262cb6da4b7aaa6da316c4f542988e3b7..ae4265282c9867e8f06ecdcb40d64c91f363972a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.30.2.2.2.7 2004-05-12 21:21:48 didg 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"))
index 5b42bc1e381f07c98a9c98523656c1e93603c940..d800c49aa858bbab79d7dff5ab2bf3bcf33c3d18 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: globals.h,v 1.18.2.2.2.3 2004-01-08 19:16:57 lenneis Exp $
+ * $Id: globals.h,v 1.18.2.2.2.4 2004-06-09 02:07:15 bfernhomberg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -38,6 +38,7 @@
 #define OPTION_PROXY         (1 << 3)
 #define OPTION_CUSTOMICON    (1 << 4)
 #define OPTION_NOSLP         (1 << 5)
+#define OPTION_ANNOUNCESSH   (1 << 6)
 
 #ifdef FORCE_UIDGID
 /* set up a structure for this */
index 937b517f4bf842c2b49243a250affdd952a5902d..2b96f87d3b30c462df789af07ae42ada379a77c8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: status.c,v 1.13.6.5 2004-06-09 01:31:14 bfernhomberg Exp $
+ * $Id: status.c,v 1.13.6.6 2004-06-09 02:07:15 bfernhomberg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -230,7 +230,7 @@ server_signature_done:
 
 static int status_netaddress(char *data, int *servoffset,
                              const ASP asp, const DSI *dsi,
-                             const char *fqdn)
+                             const struct afp_options *options)
 {
     char               *begin;
     u_int16_t          offset;
@@ -252,7 +252,8 @@ static int status_netaddress(char *data, int *servoffset,
     /* number of addresses. this currently screws up if we have a dsi
        connection, but we don't have the ip address. to get around this,
        we turn off the status flag for tcp/ip. */
-    *data++ = ((fqdn && dsi)? 1 : 0) + (dsi ? 1 : 0) + (asp ? 1 : 0);
+    *data++ = ((options->fqdn && dsi)? 1 : 0) + (dsi ? 1 : 0) + (asp ? 1 : 0) +
+              (((options->flags & OPTION_ANNOUNCESSH) && options->fqdn && dsi)? 1 : 0);
 
     /* ip address */
     if (dsi) {
@@ -277,12 +278,25 @@ static int status_netaddress(char *data, int *servoffset,
     }
 
     /* handle DNS names */
-    if (fqdn && dsi) {
-        int len = strlen(fqdn);
+    if (options->fqdn && dsi) {
+        int len = strlen(options->fqdn);
         *data++ = len +2;
         *data++ = 0x04;
-        memcpy(data, fqdn, len);
+        memcpy(data, options->fqdn, len);
         data += len;
+
+        /* Annouce support for SSH tunneled AFP session, 
+         * this feature is available since 10.3.2.
+         * According to the specs (AFP 3.1 p.225) this should
+         * be an IP+Port style value, but it only works with 
+         * a FQDN. OSX Server uses FQDN as well.
+         */
+        if (options->flags & OPTION_ANNOUNCESSH) {
+            *data++ = len +2;
+            *data++ = 0x05;
+            memcpy(data, options->fqdn, len);
+            data += len;
+        }
     }
 
 #ifndef NO_DDP
@@ -515,7 +529,7 @@ void status_init(AFPConfig *aspconfig, AFPConfig *dsiconfig,
     sigoff = status_signature(status, &c, dsi, options);
     /* c now contains the offset where the netaddress offset lives */
 
-    status_netaddress(status, &c, asp, dsi, options->fqdn);
+    status_netaddress(status, &c, asp, dsi, options);
     /* c now contains the offset where the Directory Names Count offset lives */
 
     statuslen = status_directorynames(status, &c, dsi, options);