]> arthur.barton.de Git - netatalk.git/commitdiff
Return the right AFP version info. From HAT.
authorfranklahm <franklahm>
Sun, 22 Nov 2009 11:52:38 +0000 (11:52 +0000)
committerfranklahm <franklahm>
Sun, 22 Nov 2009 11:52:38 +0000 (11:52 +0000)
etc/afpd/auth.c
etc/afpd/status.c
etc/afpd/status.h

index 52eb0b59496dea864290fb6940f59db0b89a8841..3af6d6660d7c6e57eed172f13d69ee1805c53d2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth.c,v 1.69 2009-10-25 07:18:12 didg Exp $
+ * $Id: auth.c,v 1.70 2009-11-22 11:52:38 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -74,15 +74,17 @@ int ngroups;
  * These numbers are scattered throughout the code.
  */
 static struct afp_versions  afp_versions[] = {
+#ifndef NO_DDP
     { "AFPVersion 1.1", 11 },
     { "AFPVersion 2.0", 20 },
     { "AFPVersion 2.1", 21 },
+#endif /* ! NO_DDP */
     { "AFP2.2", 22 },
 #ifdef AFP3x
     { "AFPX03", 30 },
     { "AFP3.1", 31 },
     { "AFP3.2", 32 }
-#endif
+#endif /* AFP3x */
 };
 
 static struct uam_mod uam_modules = {NULL, NULL, &uam_modules, &uam_modules};
@@ -94,17 +96,30 @@ static struct uam_obj uam_changepw = {"", "", 0, {{NULL, NULL, NULL, NULL}}, &ua
 static struct uam_obj *afp_uam = NULL;
 
 
-void status_versions( char *data)
+void status_versions( char *data, const ASP asp, const DSI *dsi)
 {
     char                *start = data;
     u_int16_t           status;
-    int         len, num, i;
+    int         len, num, i, count = 0;
 
     memcpy(&status, start + AFPSTATUS_VERSOFF, sizeof(status));
     num = sizeof( afp_versions ) / sizeof( afp_versions[ 0 ] );
+
+    for ( i = 0; i < num; i++ ) {
+#ifndef NO_DDP
+        if ( !asp && (afp_versions[ i ].av_number <= 21)) continue;
+#endif /* ! NO_DDP */
+        if ( !dsi && (afp_versions[ i ].av_number >= 22)) continue;
+        count++;
+    }
     data += ntohs( status );
-    *data++ = num;
+    *data++ = count;
+
     for ( i = 0; i < num; i++ ) {
+#ifndef NO_DDP
+        if ( !asp && (afp_versions[ i ].av_number <= 21)) continue;
+#endif /* ! NO_DDP */
+        if ( !dsi && (afp_versions[ i ].av_number >= 22)) continue;
         len = strlen( afp_versions[ i ].av_name );
         *data++ = len;
         memcpy( data, afp_versions[ i ].av_name , len );
index 1e46dd86b9fb5927eeea619293a869d12c94c486..51c761dae05c0c4d48084b2fe9007a130bbc7091 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: status.c,v 1.28 2009-11-06 03:52:42 didg Exp $
+ * $Id: status.c,v 1.29 2009-11-22 11:52:38 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -574,7 +574,7 @@ void status_init(AFPConfig *aspconfig, AFPConfig *dsiconfig,
     c = status_server(status, options->server ? options->server :
                       options->hostname, options);
     status_machine(status);
-    status_versions(status);
+    status_versions(status, asp, dsi);
     status_uams(status, options->uamlist);
     if (options->flags & OPTION_CUSTOMICON)
         status_icon(status, icon, sizeof(icon), c);
index 4b7fb7e7835a85ef276f6d58c7acca58adf6321d..759c2b26f6987c92e6b95916d2ad945ca78a9a50 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: status.h,v 1.9 2009-10-15 10:43:13 didg Exp $
+ * $Id: status.h,v 1.10 2009-11-22 11:52:38 franklahm Exp $
  */
 
 #ifndef AFPD_STATUS_H
@@ -39,7 +39,7 @@
 #define PASSWD_NOSAVE  (1 << 1)
 #define PASSWD_ALL     (PASSWD_SET | PASSWD_NOSAVE)
 
-extern void status_versions (char * /*status*/);
+extern void status_versions (char * /*status*/, const ASP, const DSI *);
 extern void status_uams (char * /*status*/, const char * /*authlist*/);
 extern void status_reset (void );
 extern void status_init (AFPConfig *, AFPConfig *,