]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/uam.c
commenting changes, more autoconf support in afpd, etc
[netatalk.git] / etc / afpd / uam.c
index af39f358f86e29ef3b4a9ab6c2045d01fb595d47..f171d2a1ef2c3c877a196fcb44bfcdc7ab7fc322 100644 (file)
@@ -1,16 +1,34 @@
-/* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
+/*
+ * $Id: uam.c,v 1.9 2001-06-20 18:33:04 rufustfirefly Exp $
+ *
+ * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#ifdef HAVE_FCNTL_H
 #include <fcntl.h>
+#endif /* HAVE_FCNTL_H */
 #include <ctype.h>
 #include <syslog.h>
 #include <sys/param.h>
 #include <sys/time.h>
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif /* HAVE_DLFCN_H */
+
+#ifdef SHADOWPW
+#include <shadow.h>
+#endif /* SHADOWPW */
 
 #include <netatalk/endian.h>
 #include <atalk/asp.h>
@@ -19,7 +37,7 @@
 #include <atalk/util.h>
 
 #include "globals.h"
-#include "config.h"
+#include "afp_config.h"
 #include "auth.h"
 #include "uam_auth.h"
 
@@ -46,6 +64,9 @@ struct uam_mod *uam_load(const char *path, const char *name)
   if ((p = strchr(buf, '.')))
     *p = '\0';
   if ((mod->uam_fcn = mod_symbol(module, buf)) == NULL) {
+    syslog(LOG_ERR, "uam_load(%s): mod_symbol error for symbol %s",
+          name,
+          buf);
     goto uam_load_err;
   }
 
@@ -174,7 +195,7 @@ struct passwd *uam_getname(char *name, const int len)
 
   setpwent();
   while ((pwent = getpwent())) {
-    if (user = strchr(pwent->pw_gecos, ','))
+    if ((user = strchr(pwent->pw_gecos, ',')))
       *user = '\0';
     user = pwent->pw_gecos;
 
@@ -187,7 +208,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;
@@ -206,10 +227,12 @@ int uam_checkuser(const struct passwd *pwd)
   }
   endusershell();
 
+#ifdef DISABLE_SHELLCHECK
   if (!p) {
     syslog( LOG_INFO, "illegal shell %s for %s", pwd->pw_shell, pwd->pw_name);
     return -1;
   }
+#endif /* DISABLE_SHELLCHECK */
 
   return 0;
 }
@@ -304,6 +327,10 @@ int uam_afpserver_option(void *private, const int what, void *option,
       *len = strlen(obj->options.hostname);
     break;
 
+  case UAM_OPTION_PROTOCOL:
+    *buf = (void *) obj->proto;
+    break;
+
   case UAM_OPTION_COOKIE: 
     /* it's up to the uam to actually store something useful here.
      * this just passes back a handle to the cookie. the uam side
@@ -346,7 +373,7 @@ int uam_afp_read(void *handle, char *buf, int *buflen,
        goto uam_afp_read_err;
       }
        
-      while (len = (dsi_write(obj->handle, buf, *buflen))) {
+      while ((len = (dsi_write(obj->handle, buf, *buflen)))) {
        if ((len = action(handle, buf, len)) < 0) {
          dsi_writeflush(obj->handle);
          goto uam_afp_read_err;
@@ -360,3 +387,9 @@ uam_afp_read_err:
   *buflen = 0;
   return len;
 }
+
+/* --- papd-specific functions (just placeholders) --- */
+void append(void *pf, char *data, int len)
+{
+       return;
+}