]> arthur.barton.de Git - netatalk.git/commitdiff
more verbose error msgs.
authordidg <didg>
Tue, 4 May 2004 15:38:23 +0000 (15:38 +0000)
committerdidg <didg>
Tue, 4 May 2004 15:38:23 +0000 (15:38 +0000)
17 files changed:
etc/afpd/afp_asp.c
etc/afpd/afp_config.c
etc/afpd/afp_dsi.c
etc/afpd/auth.c
etc/afpd/desktop.c
etc/afpd/directory.c
etc/afpd/file.c
etc/afpd/filedir.c
etc/afpd/fork.c
etc/afpd/main.c
etc/afpd/volume.c
include/atalk/util.h
libatalk/cnid/cnid.c
libatalk/dsi/dsi_getsess.c
libatalk/dsi/dsi_tcp.c
libatalk/unicode/utf8.c
libatalk/util/logger.c

index 4e56cb0eb62612cf9e20cb0c4792aca43a115735..51288efec71a4706d2eb1288477e7321cc131635 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_asp.c,v 1.18.6.5 2004-04-25 23:19:06 didg Exp $
+ * $Id: afp_asp.c,v 1.18.6.6 2004-05-04 15:38:23 didg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -160,7 +160,7 @@ static void afp_asp_timedown()
     it.it_value.tv_usec = 0;
     if ( setitimer( ITIMER_REAL, &it, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_timedown: setitimer: %s", strerror(errno) );
-        afp_asp_die(1);
+        afp_asp_die(EXITERR_SYS);
     }
 
     memset(&sv, 0, sizeof(sv));
@@ -171,7 +171,7 @@ static void afp_asp_timedown()
     sv.sa_flags = SA_RESTART;
     if ( sigaction( SIGALRM, &sv, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_timedown: sigaction: %s", strerror(errno) );
-        afp_asp_die(1);
+        afp_asp_die(EXITERR_SYS);
     }
 
     /* ignore myself */
@@ -180,7 +180,7 @@ static void afp_asp_timedown()
     sv.sa_flags = SA_RESTART;
     if ( sigaction( SIGUSR1, &sv, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_timedown: sigaction SIGUSR1: %s", strerror(errno) );
-        afp_asp_die(1);
+        afp_asp_die(EXITERR_SYS);
     }
 }
 
@@ -235,7 +235,7 @@ void afp_over_asp(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ( sigaction( SIGHUP, &action, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_over_asp: sigaction: %s", strerror(errno) );
-        afp_asp_die(1);
+        afp_asp_die(EXITERR_SYS);
     }
 
     /*  install SIGTERM */
@@ -249,7 +249,7 @@ void afp_over_asp(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ( sigaction( SIGTERM, &action, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_over_asp: sigaction: %s", strerror(errno) );
-        afp_asp_die(1);
+        afp_asp_die(EXITERR_SYS);
     }
 
 #ifdef SERVERTEXT
@@ -262,7 +262,7 @@ void afp_over_asp(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ( sigaction( SIGUSR2, &action, 0) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_over_asp: sigaction: %s", strerror(errno) );
-        afp_asp_die(1);
+        afp_asp_die(EXITERR_SYS);
     }
 #endif /* SERVERTEXT */
 
@@ -277,7 +277,7 @@ void afp_over_asp(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ( sigaction( SIGUSR1, &action, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_over_asp: sigaction: %s", strerror(errno) );
-        afp_asp_die(1);
+        afp_asp_die(EXITERR_SYS);
     }
 
     LOG(log_info, logtype_afpd, "session from %u.%u:%u on %u.%u:%u",
@@ -351,7 +351,7 @@ void afp_over_asp(AFPObj *obj)
 #endif
             if ( asp_cmdreply( asp, reply ) < 0 ) {
                 LOG(log_error, logtype_afpd, "asp_cmdreply: %s", strerror(errno) );
-                afp_asp_die(1);
+                afp_asp_die(EXITERR_CLNT);
             }
             break;
 
@@ -386,7 +386,7 @@ void afp_over_asp(AFPObj *obj)
 #endif
             if ( asp_wrtreply( asp, reply ) < 0 ) {
                 LOG(log_error, logtype_afpd, "asp_wrtreply: %s", strerror(errno) );
-                afp_asp_die(1);
+                afp_asp_die(EXITERR_CLNT);
             }
             break;
         default:
index c82532955ea0b36161521e4b4b21d518ce3d79e4..db28e06b5792cf58561107ee6e28976305913b7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_config.c,v 1.22.6.5 2004-04-27 22:47:32 didg Exp $
+ * $Id: afp_config.c,v 1.22.6.6 2004-05-04 15:38:24 didg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
@@ -34,6 +34,7 @@ char *strchr (), *strrchr ();
 #endif /* HAVE_UNISTD_H */
 #include <ctype.h>
 #include <atalk/logger.h>
+#include <atalk/util.h>
 
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -210,7 +211,7 @@ static int asp_start(AFPConfig *config, AFPConfig *configs,
     if (!(asp = asp_getsession(config->obj.handle, server_children,
                                config->obj.options.tickleval))) {
         LOG(log_error, logtype_afpd, "main: asp_getsession: %s", strerror(errno) );
-        exit( 1 );
+        exit( EXITERR_CLNT );
     }
 
     if (asp->child) {
@@ -231,7 +232,7 @@ static int dsi_start(AFPConfig *config, AFPConfig *configs,
     if (!(dsi = dsi_getsession(config->obj.handle, server_children,
                                config->obj.options.tickleval))) {
         LOG(log_error, logtype_afpd, "main: dsi_getsession: %s", strerror(errno) );
-        exit( 1 );
+        exit( EXITERR_CLNT );
     }
 
     /* we've forked. */
index 6f6b5c4b8e9e762959fed76986d97447a4527906..b7ffd084aeea3ce6f93550fc1586f01f3dfb77b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.27.2.3.2.3 2003-11-11 08:48:32 didg Exp $
+ * $Id: afp_dsi.c,v 1.27.2.3.2.4 2004-05-04 15:38:24 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -118,7 +118,7 @@ static void afp_dsi_timedown()
 
     if ( setitimer( ITIMER_REAL, &it, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_timedown: setitimer: %s", strerror(errno) );
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_SYS);
     }
     memset(&sv, 0, sizeof(sv));
     sv.sa_handler = afp_dsi_die;
@@ -128,7 +128,7 @@ static void afp_dsi_timedown()
     sv.sa_flags = SA_RESTART;
     if ( sigaction( SIGALRM, &sv, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_timedown: sigaction: %s", strerror(errno) );
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_SYS);
     }
 
     /* ignore myself */
@@ -137,7 +137,7 @@ static void afp_dsi_timedown()
     sv.sa_flags = SA_RESTART;
     if ( sigaction( SIGUSR1, &sv, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_timedown: sigaction SIGHUP: %s", strerror(errno) );
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_SYS);
     }
 
 }
@@ -174,11 +174,11 @@ static void alarm_handler()
         if (!(err = pollvoltime(child.obj)))
             err = dsi_tickle(child.obj->handle);
         if (err <= 0) 
-            afp_dsi_die(1);
+            afp_dsi_die(EXITERR_CLNT);
         
     } else { /* didn't receive a tickle. close connection */
         LOG(log_error, logtype_afpd, "afp_alarm: child timed out");
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_CLNT);
     }
 }
 
@@ -232,7 +232,7 @@ void afp_over_dsi(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ( sigaction( SIGHUP, &action, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_SYS);
     }
 
     /* install SIGTERM */
@@ -247,7 +247,7 @@ void afp_over_dsi(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ( sigaction( SIGTERM, &action, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_SYS);
     }
 
 #ifdef SERVERTEXT
@@ -261,7 +261,7 @@ void afp_over_dsi(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ( sigaction( SIGUSR2, &action, 0) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_SYS);
     }
 #endif /* SERVERTEXT */
 
@@ -277,7 +277,7 @@ void afp_over_dsi(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ( sigaction( SIGUSR1, &action, 0) < 0 ) {
         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_SYS);
     }
 
     /* tickle handler */
@@ -292,7 +292,7 @@ void afp_over_dsi(AFPObj *obj)
     action.sa_flags = SA_RESTART;
     if ((sigaction(SIGALRM, &action, NULL) < 0) ||
             (setitimer(ITIMER_REAL, &dsi->timer, NULL) < 0)) {
-        afp_dsi_die(1);
+        afp_dsi_die(EXITERR_SYS);
     }
 
 #ifdef DEBUG1
@@ -310,7 +310,7 @@ void afp_over_dsi(AFPObj *obj)
         }
 
         if (cmd == DSIFUNC_TICKLE) {
-            /* so we don't get killed on the client side. */
+            /* timer is not every 30 seconds anymore, so we don't get killed on the client side. */
             if ((child.flags & CHILD_DIE))
                 dsi_tickle(dsi);
             continue;
@@ -381,7 +381,7 @@ void afp_over_dsi(AFPObj *obj)
 #endif
             if (!dsi_cmdreply(dsi, err)) {
                 LOG(log_error, logtype_afpd, "dsi_cmdreply(%d): %s", dsi->socket, strerror(errno) );
-                afp_dsi_die(1);
+                afp_dsi_die(EXITERR_CLNT);
             }
             break;
 
@@ -418,7 +418,7 @@ void afp_over_dsi(AFPObj *obj)
 #endif
             if (!dsi_wrtreply(dsi, err)) {
                 LOG(log_error, logtype_afpd, "dsi_wrtreply: %s", strerror(errno) );
-                afp_dsi_die(1);
+                afp_dsi_die(EXITERR_CLNT);
             }
             break;
 
@@ -447,5 +447,5 @@ void afp_over_dsi(AFPObj *obj)
     }
 
     /* error */
-    afp_dsi_die(1);
+    afp_dsi_die(EXITERR_CLNT);
 }
index 25577e6bb50155722eb5554e5e1f270ed94d2761..2191a62772ebf1fc321798483ca6bf5a4f27a6eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth.c,v 1.44.2.3.2.11 2004-05-04 02:53:53 bfernhomberg Exp $
+ * $Id: auth.c,v 1.44.2.3.2.12 2004-05-04 15:38:24 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -282,7 +282,7 @@ static int login(AFPObj *obj, struct passwd *pwd, void (*logout)(void), int expi
     /* Basically if the user is in the admin group, we stay root */
 
     if (( ngroups = getgroups( NGROUPS, groups )) < 0 ) {
-        LOG(log_error, logtype_afpd, "login: getgroups: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "login: %s getgroups: %s", pwd->pw_name, strerror(errno) );
         return AFPERR_BADUAM;
     }
 
@@ -333,13 +333,13 @@ static int login(AFPObj *obj, struct passwd *pwd, void (*logout)(void), int expi
             inet_ntoa( dsi->client.sin_addr ) );
 
         if (setegid( pwd->pw_gid ) < 0 || seteuid( pwd->pw_uid ) < 0) {
-            LOG(log_error, logtype_afpd, "login: %s", strerror(errno) );
+            LOG(log_error, logtype_afpd, "login: %s %s", pwd->pw_name, strerror(errno) );
             return AFPERR_BADUAM;
         }
     }
 #else /* TRU64 */
     if (setegid( pwd->pw_gid ) < 0 || seteuid( pwd->pw_uid ) < 0) {
-        LOG(log_error, logtype_afpd, "login: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "login: %s %s", pwd->pw_name, strerror(errno) );
         return AFPERR_BADUAM;
     }
 #endif /* TRU64 */
index 99a5ef5169122e735a227dda25fe413d67f7f69b..fdeb54fc248ec1a260fb37a9aa9619798cf8be64 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: desktop.c,v 1.26.2.4.2.12 2004-03-11 23:01:40 bfernhomberg Exp $
+ * $Id: desktop.c,v 1.26.2.4.2.13 2004-05-04 15:38:24 didg Exp $
  *
  * See COPYRIGHT.
  *
@@ -72,6 +72,11 @@ int          ibuflen, *rbuflen;
 
 struct savedt  si = { { 0, 0, 0, 0 }, -1, 0 };
 
+static char *icon_dtfile(struct vol *vol, u_char creator[ 4 ])
+{
+    return dtfile( vol, creator, ".icon" );
+}
+
 static int iconopen( vol, creator, flags, mode )
 struct vol     *vol;
 u_char creator[ 4 ];
@@ -87,7 +92,7 @@ u_char        creator[ 4 ];
         si.sdt_fd = -1;
     }
 
-    dtf = dtfile( vol, creator, ".icon" );
+    dtf = icon_dtfile( vol, creator);
 
     if (( si.sdt_fd = open( dtf, flags, ad_mode( dtf, mode ))) < 0 ) {
         if ( errno == ENOENT && ( flags & O_CREAT )) {
@@ -105,7 +110,7 @@ u_char      creator[ 4 ];
             *adts = '/';
 
             if (( si.sdt_fd = open( dtf, flags, ad_mode( dtf, mode ))) < 0 ) {
-                LOG(log_error, logtype_afpd, "iconopen: open %s: %s", dtf, strerror(errno) );
+                LOG(log_error, logtype_afpd, "iconopen(%s): open: %s", dtf, strerror(errno) );
                 return -1;
             }
         } else {
@@ -125,7 +130,9 @@ char        *ibuf, *rbuf;
 int            ibuflen, *rbuflen;
 {
     struct vol         *vol;
+#ifndef NO_DDP
     struct iovec       iov[ 2 ];
+#endif
     u_char             fcreator[ 4 ], imh[ 12 ], irh[ 12 ], *p;
     int                        itype, cc = AFP_OK, iovcnt = 0, buflen;
     u_int32_t           ftype, itag;
@@ -170,7 +177,7 @@ int         ibuflen, *rbuflen;
     if (lseek( si.sdt_fd, (off_t) 0L, SEEK_SET ) < 0) {
         close(si.sdt_fd);
         si.sdt_fd = -1;
-        LOG(log_error, logtype_afpd, "afp_addicon: lseek: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "afp_addicon(%s): lseek: %s", icon_dtfile(vol, fcreator), strerror(errno) );
         cc = AFPERR_PARAM;
         goto addicon_err;
     }
@@ -205,7 +212,7 @@ int         ibuflen, *rbuflen;
         }
 
         if ( lseek( si.sdt_fd, (off_t) rsize, SEEK_CUR ) < 0 ) {
-            LOG(log_error, logtype_afpd, "afp_addicon: lseek: %s", strerror(errno) );
+            LOG(log_error, logtype_afpd, "afp_addicon(%s): lseek: %s", icon_dtfile(vol, fcreator),strerror(errno) );
             cc = AFPERR_PARAM;
         }
     }
@@ -215,7 +222,6 @@ int         ibuflen, *rbuflen;
      */
 addicon_err:
     if ( cc < 0 ) {
-        LOG(log_error, logtype_afpd, "afp_addicon: %s", strerror(errno) );
         if (obj->proto == AFPPROTO_DSI) {
             dsi_writeinit(obj->handle, rbuf, buflen);
             dsi_writeflush(obj->handle);
@@ -223,7 +229,6 @@ addicon_err:
         return cc;
     }
 
-
     switch (obj->proto) {
 #ifndef NO_DDP
     case AFPPROTO_ASP:
@@ -258,7 +263,7 @@ addicon_err:
         }
 
         if ( writev( si.sdt_fd, iov, iovcnt ) < 0 ) {
-            LOG(log_error, logtype_afpd, "afp_addicon: writev: %s", strerror(errno) );
+            LOG(log_error, logtype_afpd, "afp_addicon(%s): writev: %s", icon_dtfile(vol, fcreator), strerror(errno) );
             return( AFPERR_PARAM );
         }
         break;
@@ -271,13 +276,13 @@ addicon_err:
 
             /* add headers at end of file */
             if ((cc == 0) && (write(si.sdt_fd, imh, sizeof(imh)) < 0)) {
-                LOG(log_error, logtype_afpd, "afp_addicon: write: %s", strerror(errno));
+                LOG(log_error, logtype_afpd, "afp_addicon(%s): write: %s", icon_dtfile(vol, fcreator), strerror(errno));
                 dsi_writeflush(dsi);
                 return AFPERR_PARAM;
             }
 
             if ((cc = write(si.sdt_fd, rbuf, iovcnt)) < 0) {
-                LOG(log_error, logtype_afpd, "afp_addicon: write: %s", strerror(errno));
+                LOG(log_error, logtype_afpd, "afp_addicon(%s): write: %s", icon_dtfile(vol, fcreator), strerror(errno));
                 dsi_writeflush(dsi);
                 return AFPERR_PARAM;
             }
@@ -290,7 +295,7 @@ addicon_err:
                 }
 #endif
                 if ((cc = write(si.sdt_fd, rbuf, iovcnt)) < 0) {
-                    LOG(log_error, logtype_afpd, "afp_addicon: write: %s", strerror(errno));
+                    LOG(log_error, logtype_afpd, "afp_addicon(%s): write: %s", icon_dtfile(vol, fcreator), strerror(errno));
                     dsi_writeflush(dsi);
                     return AFPERR_PARAM;
                 }
@@ -404,7 +409,7 @@ int         ibuflen, *rbuflen;
         memcpy( &bsize, ih + 10, sizeof( bsize ));
         bsize = ntohs(bsize);
         if ( lseek( si.sdt_fd, (off_t) bsize, SEEK_CUR ) < 0 ) {
-            LOG(log_error, logtype_afpd, "afp_iconinfo: lseek: %s", strerror(errno) );
+            LOG(log_error, logtype_afpd, "afp_iconinfo(%s): lseek: %s", icon_dtfile(vol, fcreator), strerror(errno) );
             return( AFPERR_PARAM );
         }
         if ( si.sdt_index == iindex ) {
@@ -463,7 +468,7 @@ int         ibuflen, *rbuflen;
     if ( lseek( si.sdt_fd, (off_t) 0L, SEEK_SET ) < 0 ) {
         close(si.sdt_fd);
         si.sdt_fd = -1;
-        LOG(log_error, logtype_afpd, "afp_geticon: lseek: %s", strerror(errno));
+        LOG(log_error, logtype_afpd, "afp_geticon(%s): lseek: %s", icon_dtfile(vol, fcreator), strerror(errno));
         return( AFPERR_PARAM );
     }
 
@@ -479,14 +484,14 @@ int               ibuflen, *rbuflen;
         memcpy( &rsize, ih + 10, sizeof( rsize ));
         rsize = ntohs( rsize );
         if ( lseek( si.sdt_fd, (off_t) rsize, SEEK_CUR ) < 0 ) {
-            LOG(log_error, logtype_afpd, "afp_geticon: lseek: %s", strerror(errno) );
+            LOG(log_error, logtype_afpd, "afp_geticon(%s): lseek: %s", icon_dtfile(vol, fcreator), strerror(errno) );
             return( AFPERR_PARAM );
         }
         offset += rsize;
     }
 
     if ( rc < 0 ) {
-        LOG(log_error, logtype_afpd, "afp_geticon: read: %s", strerror(errno));
+        LOG(log_error, logtype_afpd, "afp_geticon(%s): read: %s", icon_dtfile(vol, fcreator), strerror(errno));
         return( AFPERR_PARAM );
     }
 
@@ -552,9 +557,9 @@ geticon_done:
         return AFP_OK;
 
 geticon_exit:
-        LOG(log_info, logtype_afpd, "afp_geticon: %s", strerror(errno));
+        LOG(log_info, logtype_afpd, "afp_geticon(%s): %s", icon_dtfile(vol, fcreator), strerror(errno));
         dsi_readdone(dsi);
-        obj->exit(1);
+        obj->exit(EXITERR_SYS);
         return AFP_OK;
 
     } else {
index 0cd45be65b8a730128d8fe2a9e090b36469f82e6..239a1de2a933804cb3f2e79b5ca0c89c5538f70a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.71.2.4.2.12 2004-03-11 16:16:40 didg Exp $
+ * $Id: directory.c,v 1.71.2.4.2.13 2004-05-04 15:38:24 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1728,8 +1728,8 @@ int setdirparams(const struct vol *vol,
                     goto setdirparam_done;
                     break;
                 default :
-                    LOG(log_error, logtype_afpd, "setdirparam: setdeskowner: %s",
-                        strerror(errno) );
+                    LOG(log_error, logtype_afpd, "setdirparam(%s): setdeskowner: %s",
+                        path->u_name, strerror(errno) );
                     if (!isad) {
                         err = AFPERR_PARAM;
                         goto setdirparam_done;
@@ -1749,8 +1749,8 @@ int setdirparams(const struct vol *vol,
                     goto setdirparam_done;
                     break;
                 default :
-                    LOG(log_error, logtype_afpd, "setdirparam: setdirowner: %s",
-                        strerror(errno) );
+                    LOG(log_error, logtype_afpd, "setdirparam(%s): setdirowner: %s",
+                        path->u_name, strerror(errno) );
                     break;
                 }
             }
@@ -1774,7 +1774,7 @@ int setdirparams(const struct vol *vol,
                 goto setdirparam_done;
                 break;
             default :
-                LOG(log_error, logtype_afpd, "setdirparam: setdeskowner: %m" );
+                LOG(log_error, logtype_afpd, "setdirparam(%s): setdeskowner: %s", path->u_name, strerror(errno)  );
                 if (!isad) {
                     err = AFPERR_PARAM;
                     goto setdirparam_done;
@@ -1795,8 +1795,8 @@ int setdirparams(const struct vol *vol,
                     goto setdirparam_done;
                     break;
                 default :
-                    LOG(log_error, logtype_afpd, "setdirparam: setdirowner: %s",
-                        strerror(errno) );
+                    LOG(log_error, logtype_afpd, "setdirparam(%s): setdirowner: %s",
+                        path->u_name, strerror(errno) );
                     break;
                 }
             }
@@ -1822,8 +1822,8 @@ int setdirparams(const struct vol *vol,
                 err = AFPERR_VLOCK;
                 goto setdirparam_done;
             default :
-                LOG(log_error, logtype_afpd, "setdirparam: setdeskmode: %s",
-                    strerror(errno) );
+                LOG(log_error, logtype_afpd, "setdirparam(%s): setdeskmode: %s",
+                    path->u_name, strerror(errno) );
                 break;
                 err = AFPERR_PARAM;
                 goto setdirparam_done;
@@ -1840,8 +1840,8 @@ int setdirparams(const struct vol *vol,
                     err = AFPERR_VLOCK;
                     goto setdirparam_done;
                 default :
-                    LOG(log_error, logtype_afpd, "setdirparam: setdirmode: %s",
-                        strerror(errno) );
+                    LOG(log_error, logtype_afpd, "setdirparam(%s): setdirmode: %s",
+                        path->u_name, strerror(errno) );
                     err = AFPERR_PARAM;
                     goto setdirparam_done;
                 }
@@ -1879,8 +1879,8 @@ int setdirparams(const struct vol *vol,
                 err = AFPERR_VLOCK;
                 goto setdirparam_done;
             default :
-                LOG(log_error, logtype_afpd, "setdirparam: setdeskmode: %s",
-                    strerror(errno) );
+                LOG(log_error, logtype_afpd, "setdirparam(%s): setdeskmode: %s",
+                    path->u_name, strerror(errno) );
                 break;
                 err = AFPERR_PARAM;
                 goto setdirparam_done;
@@ -1897,8 +1897,8 @@ int setdirparams(const struct vol *vol,
                     err = AFPERR_VLOCK;
                     goto setdirparam_done;
                 default :
-                    LOG(log_error, logtype_afpd, "setdirparam: setdirmode: %s",
-                        strerror(errno) );
+                    LOG(log_error, logtype_afpd, "setdirparam(%s): setdirmode: %s",
+                        path->u_name, strerror(errno) );
                     err = AFPERR_PARAM;
                     goto setdirparam_done;
                 }
index 0b49be1aea4d6b6af921749cef9ff8eda991d242..d903305e1be60447038c3cbdd37c778dbbcee3fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.92.2.2.2.23 2004-03-19 13:47:16 didg Exp $
+ * $Id: file.c,v 1.92.2.2.2.24 2004-05-04 15:38:24 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -2087,7 +2087,7 @@ int               ibuflen, *rbuflen;
 
     if ( setegid(gid) < 0 || seteuid(uid) < 0) {
         LOG(log_error, logtype_afpd, "can't seteuid back %s", strerror(errno));
-        exit(1);
+        exit(EXITERR_SYS);
     }
 
 #ifdef DEBUG
index fb39c1f14fd63395cd2570bc6efe3c6b77752dfe..4a456234162e8eccc501723bbd8ebdaeb7a5ea67 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: filedir.c,v 1.45.2.2.2.9 2004-03-11 02:02:01 didg Exp $
+ * $Id: filedir.c,v 1.45.2.2.2.10 2004-05-04 15:38:25 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -93,29 +93,29 @@ more information */
             if (lchown(upath, sb.st_uid, sb.st_gid) < 0)
             {
                 LOG(log_error, logtype_afpd,
-                    "matchfile2dirperms: Error changing owner/gid of %s: %s",
+                    "matchfile2dirperms(%s): Error changing owner/gid: %s",
                     upath, strerror(errno));
                 ret = AFPERR_ACCESS;
             }
             else if (chmod(upath,(st.st_mode&~default_options.umask)| S_IRGRP| S_IROTH) < 0)
             {
                 LOG(log_error, logtype_afpd,
-                    "matchfile2dirperms Error adding file read permissions: %s",
-                    strerror(errno));
+                    "matchfile2dirperms(%s): Error adding file read permissions: %s",
+                    upath, strerror(errno));
                 ret = AFPERR_ACCESS;
             }
             else if (lchown(adpath, sb.st_uid, sb.st_gid) < 0)
             {
                 LOG(log_error, logtype_afpd,
-                    "matchfile2dirperms: Error changing AppleDouble owner/gid %s: %s",
+                    "matchfile2dirperms(%s): Error changing AppleDouble owner/gid: %s",
                     adpath, strerror(errno));
                 ret = AFPERR_ACCESS;
             }
             else if (chmod(adpath, (st.st_mode&~default_options.umask)| S_IRGRP| S_IROTH) < 0)
             {
                 LOG(log_error, logtype_afpd,
-                    "matchfile2dirperms:  Error adding AD file read permissions: %s",
-                    strerror(errno));
+                    "matchfile2dirperms(%s):  Error adding AD file read permissions: %s",
+                    adpath, strerror(errno));
                 ret = AFPERR_ACCESS;
             }
             seteuid(uid); 
index 9996847a8cfbd02eb2c3569f714272b538a46277..010a12d9bb0bb07f5d73a052facf1bc88405f0ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: fork.c,v 1.51.2.2.2.9 2004-05-04 14:26:13 didg Exp $
+ * $Id: fork.c,v 1.51.2.2.2.10 2004-05-04 15:38:25 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -319,7 +319,7 @@ int         ibuflen, *rbuflen;
     case EACCES:
         return (access & OPENACC_WR) ? AFPERR_LOCK : AFPERR_ACCESS;
     default:
-        LOG(log_error, logtype_afpd, "afp_openfork: ad_open: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "afp_openfork(%s): ad_open: %s", s_path->m_name, strerror(errno) );
         return AFPERR_PARAM;
     }
     /* FIXME should we check it first ? */
@@ -400,7 +400,7 @@ int         ibuflen, *rbuflen;
                 goto openfork_err;
                 break;
             default:
-                LOG(log_error, logtype_afpd, "afp_openfork: ad_open: %s", strerror(errno) );
+                LOG(log_error, logtype_afpd, "afp_openfork(%s): ad_open: %s", s_path->m_name, strerror(errno) );
                 ret = AFPERR_PARAM;
                 goto openfork_err;
                 break;
@@ -447,7 +447,7 @@ int         ibuflen, *rbuflen;
                 goto openfork_err;
                 break;
             default:
-                LOG(log_error, logtype_afpd, "afp_openfork: ad_open: %s", strerror(errno) );
+                LOG(log_error, logtype_afpd, "afp_openfork(%s): ad_open: %s", s_path->m_name, strerror(errno) );
                 goto openfork_err;
                 break;
             }
@@ -512,7 +512,7 @@ int         ibuflen, *rbuflen;
                 break;
             default:
                 *rbuflen = 0;
-                LOG(log_error, logtype_afpd, "afp_openfork: ad_lock: %s", strerror(ret) );
+                LOG(log_error, logtype_afpd, "afp_openfork(%s): ad_lock: %s", s_path->m_name, strerror(ret) );
                 return( AFPERR_PARAM );
             }
         }
@@ -557,7 +557,7 @@ int         ibuflen, *rbuflen;
 
     *rbuflen = 0;
     if (NULL == ( ofork = of_find( ofrefnum )) ) {
-        LOG(log_error, logtype_afpd, "afp_setforkparams: of_find could not locate open fork refnum: %u", ofrefnum );
+        LOG(log_error, logtype_afpd, "afp_setforkparams: of_find(%d) could not locate fork", ofrefnum );
         return( AFPERR_PARAM );
     }
 
@@ -628,7 +628,7 @@ int         ibuflen, *rbuflen;
             goto afp_setfork_err;
 
         if (ad_flush( ofork->of_ad, ADFLAGS_HF ) < 0) {
-            LOG(log_error, logtype_afpd, "afp_setforkparams: ad_flush: %s",strerror(errno) );
+            LOG(log_error, logtype_afpd, "afp_setforkparams(%s): ad_flush: %s", ofork->of_name, strerror(errno) );
             return AFPERR_PARAM;
         }
     } else
@@ -636,7 +636,7 @@ int         ibuflen, *rbuflen;
 
 #ifdef AFS
     if ( flushfork( ofork ) < 0 ) {
-        LOG(log_error, logtype_afpd, "afp_setforkparams: flushfork: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "afp_setforkparams(%s): flushfork: %s", ofork->of_name, strerror(errno) );
     }
 #endif /* AFS */
 
@@ -696,7 +696,7 @@ int     is64;
     ibuf += sizeof(ofrefnum);
 
     if (NULL == ( ofork = of_find( ofrefnum )) ) {
-        LOG(log_error, logtype_afpd, "afp_bytelock: of_find");
+        LOG(log_error, logtype_afpd, "afp_bytelock: of_find(%d) could not locate fork", ofrefnum );
         return( AFPERR_PARAM );
     }
 
@@ -812,7 +812,7 @@ static __inline__ ssize_t read_file(struct ofork *ofork, int eid,
 
     cc = ad_read(ofork->of_ad, eid, offset, rbuf, *rbuflen);
     if ( cc < 0 ) {
-        LOG(log_error, logtype_afpd, "afp_read: ad_read: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "afp_read(%s): ad_read: %s", ofork->of_name, strerror(errno) );
         *rbuflen = 0;
         return( AFPERR_PARAM );
     }
@@ -886,7 +886,7 @@ int is64;
     ibuf += sizeof( u_short );
 
     if (NULL == ( ofork = of_find( ofrefnum )) ) {
-        LOG(log_error, logtype_afpd, "afp_read: of_find");
+        LOG(log_error, logtype_afpd, "afp_read: of_find(%d) could not locate fork", ofrefnum );
         err = AFPERR_PARAM;
         goto afp_read_err;
     }
@@ -982,7 +982,7 @@ int is64;
                 if (errno == EINVAL || errno == ENOSYS)
                     goto afp_read_loop;
                 else {
-                    LOG(log_error, logtype_afpd, "afp_read: ad_readfile: %s", strerror(errno));
+                    LOG(log_error, logtype_afpd, "afp_read(%s): ad_readfile: %s", ofork->of_name, strerror(errno));
                     goto afp_read_exit;
                 }
             }
@@ -1027,10 +1027,10 @@ afp_read_loop:
         goto afp_read_done;
 
 afp_read_exit:
-        LOG(log_error, logtype_afpd, "afp_read: %s", strerror(errno));
+        LOG(log_error, logtype_afpd, "afp_read(%s): %s", ofork->of_name, strerror(errno));
         dsi_readdone(dsi);
         ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff, savereqcount,ofork->of_refnum);
-        obj->exit(1);
+        obj->exit(EXITERR_CLNT);
     }
 
 afp_read_done:
@@ -1094,12 +1094,12 @@ int             ibuflen, *rbuflen;
     memcpy(&ofrefnum, ibuf, sizeof( ofrefnum ));
 
     if (NULL == ( ofork = of_find( ofrefnum )) ) {
-        LOG(log_error, logtype_afpd, "afp_flushfork: of_find");
+        LOG(log_error, logtype_afpd, "afp_flushfork: of_find(%d) could not locate fork", ofrefnum );
         return( AFPERR_PARAM );
     }
 
     if ( flushfork( ofork ) < 0 ) {
-        LOG(log_error, logtype_afpd, "afp_flushfork: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "afp_flushfork(%s): %s", ofork->of_name, strerror(errno) );
     }
 
     return( AFP_OK );
@@ -1115,8 +1115,8 @@ struct ofork      *ofork;
 
     if ( ad_dfileno( ofork->of_ad ) != -1 &&
             fsync( ad_dfileno( ofork->of_ad )) < 0 ) {
-        LOG(log_error, logtype_afpd, "flushfork: dfile(%d) %s",
-            ad_dfileno(ofork->of_ad), strerror(errno) );
+        LOG(log_error, logtype_afpd, "flushfork(%s): dfile(%d) %s",
+            ofork->of_name, ad_dfileno(ofork->of_ad), strerror(errno) );
         err = -1;
     }
 
@@ -1141,8 +1141,8 @@ struct ofork      *ofork;
             err = -1;
 
         if (err < 0)
-            LOG(log_error, logtype_afpd, "flushfork: hfile(%d) %s",
-                ad_hfileno(ofork->of_ad), strerror(errno) );
+            LOG(log_error, logtype_afpd, "flushfork(%s): hfile(%d) %s",
+                ofork->of_name, ad_hfileno(ofork->of_ad), strerror(errno) );
     }
 
     return( err );
@@ -1163,7 +1163,7 @@ int               ibuflen, *rbuflen;
     memcpy(&ofrefnum, ibuf, sizeof( ofrefnum ));
 
     if (NULL == ( ofork = of_find( ofrefnum )) ) {
-        LOG(log_error, logtype_afpd, "afp_closefork: of_find");
+        LOG(log_error, logtype_afpd, "afp_closefork: of_find(%d) could not locate fork", ofrefnum );
         return( AFPERR_PARAM );
     }
 
@@ -1189,7 +1189,7 @@ int               ibuflen, *rbuflen;
     }
 
     if ( ad_close( ofork->of_ad, adflags ) < 0 ) {
-        LOG(log_error, logtype_afpd, "afp_closefork: ad_close: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "afp_closefork(%s): ad_close: %s", ofork->of_name, strerror(errno) );
         return( AFPERR_PARAM );
     }
 
@@ -1226,7 +1226,7 @@ static __inline__ ssize_t write_file(struct ofork *ofork, int eid,
         case ENOSPC :
             return( AFPERR_DFULL );
         default :
-            LOG(log_error, logtype_afpd, "afp_write: ad_write: %s", strerror(errno) );
+            LOG(log_error, logtype_afpd, "afp_write(%s): ad_write: %s", ofork->of_name, strerror(errno) );
             return( AFPERR_PARAM );
         }
     }
@@ -1261,7 +1261,7 @@ int                 is64;
     reqcount = get_off_t(&ibuf, is64);
 
     if (NULL == ( ofork = of_find( ofrefnum )) ) {
-        LOG(log_error, logtype_afpd, "afp_write: of_find");
+        LOG(log_error, logtype_afpd, "afp_write: of_find(%d) could not locate fork", ofrefnum );
         err = AFPERR_PARAM;
         goto afp_write_err;
     }
@@ -1460,7 +1460,7 @@ int               ibuflen, *rbuflen;
 
     *rbuflen = 0;
     if (NULL == ( ofork = of_find( ofrefnum )) ) {
-        LOG(log_error, logtype_afpd, "afp_getforkparams: of_find");
+        LOG(log_error, logtype_afpd, "afp_getforkparams: of_find(%d) could not locate fork", ofrefnum );
         return( AFPERR_PARAM );
     }
     attrbits = ((ofork->of_ad->ad_df.adf_refcount > 0) ? ATTRBIT_DOPEN : 0);
@@ -1468,7 +1468,7 @@ int               ibuflen, *rbuflen;
 
     if ( ad_hfileno( ofork->of_ad ) != -1 ) {
         if ( ad_refresh( ofork->of_ad ) < 0 ) {
-            LOG(log_error, logtype_afpd, "getforkparams: ad_refresh: %s", strerror(errno) );
+            LOG(log_error, logtype_afpd, "getforkparams(%s): ad_refresh: %s", ofork->of_name, strerror(errno) );
             return( AFPERR_PARAM );
         }
     }
index a041e6b368d619124639d3bb871a546cffccdc82..dddf099bce22e397152d7700c4ed9ddc46bdf7c8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.c,v 1.20.4.2.2.7 2004-04-27 22:47:32 didg Exp $
+ * $Id: main.c,v 1.20.4.2.2.8 2004-05-04 15:38:25 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -122,7 +122,7 @@ static void afp_goaway(int sig)
             configfree(configs, NULL);
             if (!(configs = configinit(&default_options))) {
                 LOG(log_error, logtype_afpd, "config re-read: no servers configured");
-                afp_exit(1);
+                afp_exit(EXITERR_CONF);
             }
             set_fd(Ipc_fd);
         } else {
@@ -174,7 +174,7 @@ char        **av;
 #endif
     afp_options_init(&default_options);
     if (!afp_options_parse(ac, av, &default_options))
-        exit(1);
+        exit(EXITERR_CONF);
 
     /* Save the user's current umask for use with CNID (and maybe some 
      * other things, too). */
@@ -183,7 +183,7 @@ char        **av;
     switch(server_lock("afpd", default_options.pidfile,
                        default_options.flags & OPTION_DEBUG)) {
     case -1: /* error */
-        exit(1);
+        exit(EXITERR_SYS);
     case 0: /* child */
         break;
     default: /* server */
@@ -199,7 +199,7 @@ char        **av;
     if (!(server_children = server_child_alloc(default_options.connections,
                             CHILD_NFORKS))) {
         LOG(log_error, logtype_afpd, "main: server_child alloc: %s", strerror(errno) );
-        afp_exit(1);
+        afp_exit(EXITERR_SYS);
     }
     
 #ifdef AFP3x
@@ -221,7 +221,7 @@ char        **av;
     sv.sa_flags = SA_RESTART;
     if ( sigaction( SIGCHLD, &sv, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
-        afp_exit(1);
+        afp_exit(EXITERR_SYS);
     }
 
     sv.sa_handler = afp_goaway;
@@ -233,7 +233,7 @@ char        **av;
     sv.sa_flags = SA_RESTART;
     if ( sigaction( SIGUSR1, &sv, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
-        afp_exit(1);
+        afp_exit(EXITERR_SYS);
     }
 
     sigemptyset( &sv.sa_mask );
@@ -244,7 +244,7 @@ char        **av;
     sv.sa_flags = SA_RESTART;
     if ( sigaction( SIGHUP, &sv, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
-        afp_exit(1);
+        afp_exit(EXITERR_SYS);
     }
 
 
@@ -256,7 +256,7 @@ char        **av;
     sv.sa_flags = SA_RESTART;
     if ( sigaction( SIGTERM, &sv, 0 ) < 0 ) {
         LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
-        afp_exit(1);
+        afp_exit(EXITERR_SYS);
     }
 
     /* afpd.conf: not in config file: lockfile, connections, configfile
@@ -280,7 +280,7 @@ char        **av;
     sigprocmask(SIG_BLOCK, &sigs, NULL);
     if (!(configs = configinit(&default_options))) {
         LOG(log_error, logtype_afpd, "main: no servers configured: %s\n", strerror(errno));
-        afp_exit(1);
+        afp_exit(EXITERR_CONF);
     }
     sigprocmask(SIG_UNBLOCK, &sigs, NULL);
 
index d2e1309f992e1c4320235b559e156c0854d3e5e5..185e72266e28463f7206407d3d913f41a6af661f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.51.2.7.2.28 2004-04-06 23:29:37 bfernhomberg Exp $
+ * $Id: volume.c,v 1.51.2.7.2.29 2004-05-04 15:38:25 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -367,7 +367,7 @@ static void volset(struct vol_option *options, struct vol_option *save,
     } else if (optionok(tmp, "codepage:", val)) {
        LOG (log_error, logtype_afpd, "The old codepage system has been removed. Please make sure to read the documentation !!!!");
        /* Make sure we don't screw anything */
-       exit (-1);
+       exit (EXITERR_CONF);
     } else if (optionok(tmp, "volcharset:", val)) {
         setoption(options, save, VOLOPT_ENCODING, val);
     } else if (optionok(tmp, "maccharset:", val)) {
@@ -1469,7 +1469,7 @@ int       ibuflen, *rbuflen;
     for ( vcnt = 0, volume = Volumes; volume; volume = volume->v_next ) {
         if (!(volume->v_flags & AFPVOL_NOSTAT)) {
             if ( stat( volume->v_path, &st ) < 0 ) {
-                LOG(log_info, logtype_afpd, "afp_getsrvrparms: stat %s: %s",
+                LOG(log_info, logtype_afpd, "afp_getsrvrparms(%s): stat: %s",
                         volume->v_path, strerror(errno) );
                 continue;              /* can't access directory */
             }
@@ -1506,7 +1506,7 @@ int       ibuflen, *rbuflen;
     *rbuflen = data - rbuf;
     data = rbuf;
     if ( gettimeofday( &tv, 0 ) < 0 ) {
-        LOG(log_error, logtype_afpd, "afp_getsrvrparms: gettimeofday: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "afp_getsrvrparms(%s): gettimeofday: %s", volume->v_path, strerror(errno) );
         *rbuflen = 0;
         return AFPERR_PARAM;
     }
@@ -1603,7 +1603,7 @@ int               ibuflen, *rbuflen;
 
     if (volume->v_root_preexec) {
        if ((ret = afprun(1, volume->v_root_preexec, NULL)) && volume->v_root_preexec_close) {
-            LOG(log_error, logtype_afpd, "afp_openvol: root preexec : %d", ret );
+            LOG(log_error, logtype_afpd, "afp_openvol(%s): root preexec : %d", volume->v_path, ret );
             ret = AFPERR_MISC;
             goto openvol_err;
        }
@@ -1615,7 +1615,7 @@ int               ibuflen, *rbuflen;
 
     if (volume->v_preexec) {
        if ((ret = afprun(0, volume->v_preexec, NULL)) && volume->v_preexec_close) {
-            LOG(log_error, logtype_afpd, "afp_openvol: preexec : %d", ret );
+            LOG(log_error, logtype_afpd, "afp_openvol(%s): preexec : %d", volume->v_path, ret );
             ret = AFPERR_MISC;
             goto openvol_err;
        }
@@ -1640,7 +1640,7 @@ int               ibuflen, *rbuflen;
     
     if ( NULL == getcwd(path, MAXPATHLEN)) {
         /* shouldn't be fatal but it will fail later */
-        LOG(log_error, logtype_afpd, "afp_openvol: volume pathlen too long" );
+        LOG(log_error, logtype_afpd, "afp_openvol(%s): volume pathlen too long", volume->v_path);
         ret = AFPERR_MISC;
         goto openvol_err;
     }        
@@ -1652,7 +1652,7 @@ int               ibuflen, *rbuflen;
        
     if ((dir = dirnew(vol_mname, vol_uname) ) == NULL) {
        free(vol_mname);
-        LOG(log_error, logtype_afpd, "afp_openvol: malloc: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "afp_openvol(%s): malloc: %s", volume->v_path, strerror(errno) );
         ret = AFPERR_MISC;
         goto openvol_err;
     }
@@ -1726,7 +1726,9 @@ int               ibuflen, *rbuflen;
 
             /* FIXME find db time stamp */
             if (cnid_getstamp(volume->v_cdb, volume->v_stamp, sizeof(volume->v_stamp)) < 0) {
-               LOG (log_error, logtype_afpd, "Fatal error: Unable to get stamp value from CNID backend");
+               LOG (log_error, logtype_afpd, 
+                     "afp_openvol(%s): Fatal error: Unable to get stamp value from CNID backend",
+                     volume->v_path);
                goto openvol_err;
            }
        }
@@ -1922,7 +1924,7 @@ struct vol        *vol;
      * [RS] */
 
     if ( gettimeofday( &tv, 0 ) < 0 ) {
-        LOG(log_error, logtype_afpd, "setvoltime: gettimeofday: %s", strerror(errno) );
+        LOG(log_error, logtype_afpd, "setvoltime(%s): gettimeofday: %s", vol->v_path, strerror(errno) );
         return;
     }
     if( utime( vol->v_path, NULL ) < 0 ) {
@@ -2055,13 +2057,13 @@ static int create_special_folder (const struct vol *vol, const struct _special_f
        p = (char *) malloc ( strlen(vol->v_path)+strlen(folder->name)+2);
        if ( p == NULL) {
                LOG(log_error, logtype_afpd,"malloc failed");
-               exit (-1);
+               exit (EXITERR_SYS);
        }
 
        q=strdup(folder->name);
        if ( q == NULL) {
                LOG(log_error, logtype_afpd,"malloc failed");
-               exit (-1);
+               exit (EXITERR_SYS);
        }
 
        strcpy(p, vol->v_path);
index 01a2239ee3d9f6bc8cb26b6c24d44e6a3a25afef..11074d3fa745ce4bbd05c07945e56e3b98cf6b79 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: util.h,v 1.7.10.5 2004-04-21 18:45:54 bfernhomberg Exp $
+ * $Id: util.h,v 1.7.10.6 2004-05-04 15:38:26 didg Exp $
  */
 
 #ifndef _ATALK_UTIL_H
 #endif /* HAVE_UNISTD_H */
 #include <netatalk/at.h>
 
+/* exit error codes */
+#define EXITERR_CLNT 1  /* client related error */
+#define EXITERR_CONF 2  /* error in config files/cmd line parameters */
+#define EXITERR_SYS  3  /* local system error */
+
+
 extern int     sys_ftruncate __P((int fd, off_t length));
 
 #ifdef WITH_SENDFILE
index e2a4a5ad5cb6d4096379730230de82360c4ab45d..8b096591dadc74f9a4922a6790f3ea621ca0f01f 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * $Id: cnid.c,v 1.1.4.9 2004-03-19 13:18:51 bfernhomberg Exp $
+ * $Id: cnid.c,v 1.1.4.10 2004-05-04 15:38:26 didg Exp $
  *
  * Copyright (c) 2003 the Netatalk Team
  * Copyright (c) 2003 Rafal Lewczuk <rlewczuk@pronet.pl>
@@ -123,7 +123,7 @@ struct _cnid_db *cnid_open(const char *volpath, mode_t mask, char *type, int fla
         if (cnid_dir(volpath, mask) < 0) {
             if ( setegid(gid) < 0 || seteuid(uid) < 0) {
                 LOG(log_error, logtype_afpd, "can't seteuid back %s", strerror(errno));
-                exit(1);
+                exit(EXITERR_SYS);
             }
             return NULL;
         }
@@ -135,7 +135,7 @@ struct _cnid_db *cnid_open(const char *volpath, mode_t mask, char *type, int fla
         seteuid(0);
         if ( setegid(gid) < 0 || seteuid(uid) < 0) {
             LOG(log_error, logtype_afpd, "can't seteuid back %s", strerror(errno));
-            exit(1);
+            exit(EXITERR_SYS);
         }
     }
 
index 2ad64b439200e0eace53c66c62342ee9b3478a25..0dc56eff34d47cf21475c125c35c83d7fe10ce39 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dsi_getsess.c,v 1.6 2002-01-04 04:45:48 sibaz Exp $
+ * $Id: dsi_getsess.c,v 1.6.10.1 2004-05-04 15:38:26 didg Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
@@ -32,6 +32,7 @@
 
 #include <sys/time.h>
 #include <atalk/logger.h>
+#include <atalk/util.h>
 
 #include <atalk/dsi.h>
 #include <atalk/server_child.h>
@@ -91,7 +92,7 @@ DSI *dsi_getsession(DSI *dsi, server_child *serv_children,
     dsi->header.dsi_flags = DSIFL_REPLY;
     dsi->header.dsi_code = DSIERR_TOOMANY;
     dsi_send(dsi);
-    exit(1);
+    exit(EXITERR_CLNT);
   }
 
   /* get rid of some stuff */
@@ -134,6 +135,6 @@ DSI *dsi_getsession(DSI *dsi, server_child *serv_children,
   default: /* just close */
     LOG(log_info, logtype_default, "DSIUnknown %d", dsi->header.dsi_command);
     dsi->proto_close(dsi);
-    exit(1);
+    exit(EXITERR_CLNT);
   }
 }
index 2b64356ae10dc8516673417a4ca723a7750e9c81..4fe5e4c24319e37b69d5428cf592770ff4287151 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dsi_tcp.c,v 1.9.10.6 2004-04-25 23:17:56 didg Exp $
+ * $Id: dsi_tcp.c,v 1.9.10.7 2004-05-04 15:38:26 didg Exp $
  *
  * Copyright (c) 1997, 1998 Adrian Sun (asun@zoology.washington.edu)
  * All rights reserved. See COPYRIGHT.
@@ -90,7 +90,7 @@ static void dsi_tcp_close(DSI *dsi)
 static void timeout_handler()
 {
   LOG(log_error, logtype_default, "dsi_tcp_open: connection timed out");
-  exit(1);
+  exit(EXITERR_CLNT);
 }
 
 #ifdef ATACC
@@ -146,7 +146,7 @@ static int dsi_tcp_open(DSI *dsi)
     if ((sigaction(SIGALRM, &newact, &oldact) < 0) ||
         (setitimer(ITIMER_REAL, &timer, NULL) < 0)) {
        LOG(log_error, logtype_default, "dsi_tcp_open: %s", strerror(errno));
-       exit(1);
+       exit(EXITERR_SYS);
     }
     
     /* read in commands. this is similar to dsi_receive except
@@ -157,11 +157,11 @@ static int dsi_tcp_open(DSI *dsi)
     len = dsi_stream_read(dsi, block, 2);
     if (!len ) {
       /* connection already closed, don't log it (normal OSX 10.3 behaviour) */
-      exit(1);
+      exit(EXITERR_CLNT);
     }
     if (len < 2 || (block[0] > DSIFL_MAX) || (block[1] > DSIFUNC_MAX)) {
       LOG(log_error, logtype_default, "dsi_tcp_open: invalid header");
-      exit(1);
+      exit(EXITERR_CLNT);
     }      
     
     /* read in the rest of the header */
@@ -172,7 +172,7 @@ static int dsi_tcp_open(DSI *dsi)
        stored += len;
       else {
        LOG(log_error, logtype_default, "dsi_tcp_open: stream_read: %s", strerror(errno));
-       exit(1);
+       exit(EXITERR_CLNT);
       }
     }
     
@@ -196,7 +196,7 @@ static int dsi_tcp_open(DSI *dsi)
        stored += len;
       else {
        LOG(log_error, logtype_default, "dsi_tcp_open: stream_read: %s", strerror(errno));
-       exit(1);
+       exit(EXITERR_CLNT);
       }
     }
     
index 83334ba4fff84ab312f5227648efe97f0b65cae7..68e967470585fd056f2227fd7f69ef2697821a48 100644 (file)
@@ -73,14 +73,14 @@ static size_t utf8_pull(void *cd, char **inbuf, size_t *inbytesleft,
                        uc = c[0];
                } else if ((c[0] & 0xf0) == 0xe0) {
                        if (*inbytesleft < 3) {
-                               LOG(log_debug, logtype_default, "short utf8 char\n");
+                               LOG(log_debug, logtype_default, "short utf8 char");
                                goto badseq;
                        }
                        uc = ((ucs2_t) (c[0] & 0x0f) << 12) | ((ucs2_t) (c[1] ^ 0x80) << 6) | (ucs2_t) (c[2] ^ 0x80);
                        len = 3;
                } else if ((c[0] & 0xe0) == 0xc0) {
                        if (*inbytesleft < 2) {
-                               LOG(log_debug, logtype_default, "short utf8 char\n");
+                               LOG(log_debug, logtype_default, "short utf8 char");
                                goto badseq;
                        }
                        uc = ((ucs2_t) (c[0] & 0x1f) << 6) | (ucs2_t) (c[1] ^ 0x80);
@@ -124,7 +124,7 @@ static size_t utf8_push(void *cd, char **inbuf, size_t *inbytesleft,
 
                if ( uc >= 0x800 ) {
                        if (*outbytesleft < 3) {
-                               LOG(log_debug, logtype_default, "short utf8 write\n");
+                               LOG(log_debug, logtype_default, "short utf8 write");
                                goto toobig;
                        }
                        c[2] = 0x80 | (uc & 0x3f);
@@ -137,7 +137,7 @@ static size_t utf8_push(void *cd, char **inbuf, size_t *inbytesleft,
                        len = 3;
                } else if (uc >= 0x80) {
                        if (*outbytesleft < 2) {
-                               LOG(log_debug, logtype_default, "short utf8 write\n");
+                               LOG(log_debug, logtype_default, "short utf8 write");
                                goto toobig;
                        }
                        c[1] = 0x80 | (uc&0x3f);
index 4ba49fb9a094af29aa7159db1cc56bfa0645e561..0822d43f439948836e40ca0109e7fde71f974a48 100644 (file)
@@ -513,6 +513,81 @@ make_log_func set_log_location(char *srcfilename, int srclinenumber)
 }
 #endif /* DISABLE_LOGGER */
 
+/* ---------------------- 
+ * chainsawed from ethereal
+*/
+#ifdef isprint
+#undef isprint
+#endif
+#define isprint(c) ((c) >= 0x20 && (c) < 0x7f)
+
+static char *format_text(char *fmtbuf, const char *string)
+{
+  int column;
+  const char *stringend = string + strlen(string);
+  char c;
+  int i;
+
+  column = 0;
+  while (string < stringend) {
+    c = *string++;
+
+    if (isprint(c)) {
+      fmtbuf[column] = c;
+      column++;
+    } else {
+      fmtbuf[column] =  '\\';
+      column++;
+      switch (c) {
+      case '\\':
+       fmtbuf[column] = '\\';
+       column++;
+       break;
+      case '\a':
+       fmtbuf[column] = 'a';
+       column++;
+       break;
+      case '\b':
+       fmtbuf[column] = 'b';
+       column++;
+       break;
+      case '\f':
+       fmtbuf[column] = 'f';
+       column++;
+       break;
+      case '\n':
+       fmtbuf[column] = 'n';
+       column++;
+       break;
+      case '\r':
+       fmtbuf[column] = 'r';
+       column++;
+       break;
+      case '\t':
+       fmtbuf[column] = 't';
+       column++;
+       break;
+      case '\v':
+       fmtbuf[column] = 'v';
+       column++;
+       break;
+      default:
+       i = (c>>6)&03;
+       fmtbuf[column] = i + '0';
+       column++;
+       i = (c>>3)&07;
+       fmtbuf[column] = i + '0';
+       column++;
+       i = (c>>0)&07;
+       fmtbuf[column] = i + '0';
+       column++;
+       break;
+      }
+    }
+  }
+  fmtbuf[column] = '\0';
+  return fmtbuf;
+}
 /* -------------------------------------------------------------------------
     MakeLog has 1 main flaws:
       The message in its entirity, must fit into the tempbuffer.  
@@ -522,7 +597,8 @@ void make_log_entry(enum loglevels loglevel, enum logtypes logtype,
                    char *message, ...)
 {
   va_list args;
-  char log_buffer[MAXLOGSIZE];
+  char temp_buffer[MAXLOGSIZE];
+  char log_buffer[4*MAXLOGSIZE];
   /* fn is not reentrant but is used in signal handler 
    * with LOGGER it's a little late source name and line number
    * are already changed.
@@ -559,10 +635,11 @@ void make_log_entry(enum loglevels loglevel, enum logtypes logtype,
   /* Initialise the Messages */
   va_start(args, message);
 
-  vsnprintf(log_buffer, sizeof(log_buffer), message, args);
+  vsnprintf(temp_buffer, sizeof(temp_buffer), message, args);
 
   /* Finished with args for now */
   va_end(args);
+  format_text(log_buffer, temp_buffer);
 
 #ifdef DISABLE_LOGGER
   syslog(get_syslog_equivalent(loglevel), "%s", log_buffer);