]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/uam.c
changed all LOG messages using logtype_default to use logtype_papd
[netatalk.git] / etc / papd / uam.c
index c332685e9be810454bf4ebd888417849786d7e12..75435aca908cf388bff6decadeb0007c35458b01 100644 (file)
@@ -1,18 +1,38 @@
-/* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
+/*
+ * $Id: uam.c,v 1.8 2002-09-29 23:29:14 sibaz Exp $
+ *
+ * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
 
 #include <stdio.h>
 #include <stdlib.h>
+
+/* STDC check */
+#if STDC_HEADERS
 #include <string.h>
+#else /* STDC_HEADERS */
+#ifndef HAVE_STRCHR
+#define strchr index
+#define strrchr index
+#endif /* HAVE_STRCHR */
+char *strchr (), *strrchr ();
+#ifndef HAVE_MEMCPY
+#define memcpy(d,s,n) bcopy ((s), (d), (n))
+#define memmove(d,s,n) bcopy ((s), (d), (n))
+#endif /* ! HAVE_MEMCPY */
+#endif /* STDC_HEADERS */
+
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif /* HAVE_UNISTD_H */
 #include <fcntl.h>
 #include <ctype.h>
-#include <syslog.h>
+#include <atalk/logger.h>
 #include <sys/param.h>
 #include <sys/time.h>
 
@@ -34,13 +54,13 @@ struct uam_mod *uam_load(const char *path, const char *name)
   void *module;
 
   if ((module = mod_open(path)) == NULL) {
-    syslog(LOG_ERR, "uam_load(%s): failed to load.", name);
-    syslog(LOG_ERR, dlerror());
+    LOG(log_error, logtype_papd, "uam_load(%s): failed to load.", name);
+    LOG(log_error, logtype_papd, dlerror());
     return NULL;
   }
 
   if ((mod = (struct uam_mod *) malloc(sizeof(struct uam_mod))) == NULL) {
-    syslog(LOG_ERR, "uam_load(%s): malloc failed", name);
+    LOG(log_error, logtype_papd, "uam_load(%s): malloc failed", name);
     goto uam_load_fail;
   }
 
@@ -52,7 +72,7 @@ struct uam_mod *uam_load(const char *path, const char *name)
   }
 
   if (mod->uam_fcn->uam_type != UAM_MODULE_SERVER) {
-    syslog(LOG_ERR, "uam_load(%s): attempted to load a non-server module",
+    LOG(log_error, logtype_papd, "uam_load(%s): attempted to load a non-server module",
           name);
     goto uam_load_err;
   }
@@ -61,7 +81,7 @@ struct uam_mod *uam_load(const char *path, const char *name)
 
   if (!mod->uam_fcn->uam_setup || 
       ((*mod->uam_fcn->uam_setup)(name) < 0)) {
-    syslog(LOG_ERR, "uam_load(%s): uam_setup failed", name);
+    LOG(log_error, logtype_papd, "uam_load(%s): uam_setup failed", name);
     goto uam_load_err;
   }
 
@@ -101,7 +121,7 @@ int uam_register(const int type, const char *path, const char *name, ...)
   if ((uam = auth_uamfind(type, name, strlen(name)))) {
     if (strcmp(uam->uam_path, path)) {
       /* it exists, but it's not the same module. */
-      syslog(LOG_ERR, "uam_register: \"%s\" already loaded by %s",
+      LOG(log_error, logtype_papd, "uam_register: \"%s\" already loaded by %s",
             name, path);
       return -1;
     }
@@ -197,7 +217,7 @@ struct passwd *uam_getname(char *name, const int len)
     }
   }
   endpwent();
-#endif
+#endif /* NO_REAL_USER_NAME */
 
   /* os x server doesn't keep anything useful if we do getpwent */
   return pwent ? getpwnam(name) : NULL;
@@ -217,10 +237,12 @@ int uam_checkuser(const struct passwd *pwd)
   }
   endusershell();
 
+#ifndef DISABLE_SHELLCHECK
   if (!p) {
-    syslog( LOG_INFO, "illegal shell %s for %s",pwd->pw_shell,pwd->pw_name);
+    LOG(log_info, logtype_papd, "illegal shell %s for %s",pwd->pw_shell,pwd->pw_name);
     return -1;
   }
+#endif /* DISABLE_SHELLCHECK */
 
   return 0;
 }