]> arthur.barton.de Git - netatalk.git/commitdiff
afpd now also uses default values for cnidserver and port.
authorlenneis <lenneis>
Thu, 8 Jan 2004 19:16:57 +0000 (19:16 +0000)
committerlenneis <lenneis>
Thu, 8 Jan 2004 19:16:57 +0000 (19:16 +0000)
etc/afpd/afp_options.c
etc/afpd/globals.h
libatalk/cnid/dbd/cnid_dbd.c

index 62b76918daa4eddcc9eaa6e51837b312eaff2c65..781dc381e71a5be471cd9a4faddabd17397906e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: afp_options.c,v 1.30.2.2.2.3 2003-11-13 15:29:01 didg Exp $
+ * $Id: afp_options.c,v 1.30.2.2.2.4 2004-01-08 19:16:57 lenneis Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -62,8 +62,8 @@ char *strchr (), *strrchr ();
 #endif /* MIN */
 
 /* FIXME CNID */
 #endif /* MIN */
 
 /* FIXME CNID */
-char             *Cnid_srv;
-int              Cnid_port;
+char             Cnid_srv[MAXHOSTNAMELEN + 1] = "localhost";
+int              Cnid_port = 4700;
 
 #define OPTIONS "dn:f:s:uc:g:P:ptDS:TL:F:U:Ivm:"
 #define LENGTH 512
 
 #define OPTIONS "dn:f:s:uc:g:P:ptDS:TL:F:U:Ivm:"
 #define LENGTH 512
@@ -443,15 +443,13 @@ int afp_options_parseline(char *buf, struct afp_options *options)
     /* FIXME CNID Cnid_srv is a server attribute */
     if ((c = getoption(buf, "-cnidserver"))) {
         char *p;
     /* FIXME CNID Cnid_srv is a server attribute */
     if ((c = getoption(buf, "-cnidserver"))) {
         char *p;
-
-        if (Cnid_srv) {
-            free(Cnid_srv);
-        }
-        
-        Cnid_srv = strdup(c);
-        p = strchr(Cnid_srv, ':');
-        *p = 0;
-        Cnid_port = atoi(p +1);
+       int len;        
+        p = strchr(c, ':');
+       if (p != NULL && (len = p - c) <= MAXHOSTNAMELEN) {
+           memcpy(Cnid_srv, c, len);
+           Cnid_srv[len] = 0;
+           Cnid_port = atoi(p +1);
+       }
     }
 
     if ((c = getoption(buf, "-port")))
     }
 
     if ((c = getoption(buf, "-port")))
index 0dd2c5dbc91bca727ad3e08a3fee1454ec739d88..5b42bc1e381f07c98a9c98523656c1e93603c940 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: globals.h,v 1.18.2.2.2.2 2003-09-13 02:46:28 bfernhomberg Exp $
+ * $Id: globals.h,v 1.18.2.2.2.3 2004-01-08 19:16:57 lenneis Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -110,7 +110,7 @@ extern struct dir   *curdir;
 extern char            getwdbuf[];
 
 /* FIXME CNID */
 extern char            getwdbuf[];
 
 /* FIXME CNID */
-extern char             *Cnid_srv;
+extern char             Cnid_srv[MAXHOSTNAMELEN + 1];
 extern int              Cnid_port;
 
 extern int  get_afp_errno   __P((const int param));
 extern int              Cnid_port;
 
 extern int  get_afp_errno   __P((const int param));
index aa75820434748d657ee9f8ca57440ab42c2bdac1..b393f4814a7dd1596a00073f3c06cd69ca209847 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: cnid_dbd.c,v 1.1.4.10 2004-01-03 22:42:55 didg Exp $
+ * $Id: cnid_dbd.c,v 1.1.4.11 2004-01-08 19:16:58 lenneis Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYRIGHT.
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYRIGHT.
@@ -58,7 +58,7 @@ static void RQST_RESET(struct cnid_dbd_rqst  *r)
 }
 
 /* ----------- */
 }
 
 /* ----------- */
-extern char             *Cnid_srv;
+extern char             Cnid_srv[MAXHOSTNAMELEN + 1];
 extern int              Cnid_port;
 
 static int tsock_getfd(char *host, int port, int silent)
 extern int              Cnid_port;
 
 static int tsock_getfd(char *host, int port, int silent)