]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/uam.c
Merge sf.net
[netatalk.git] / etc / papd / uam.c
index 75435aca908cf388bff6decadeb0007c35458b01..2962fad0b10194d0cf9ae1a7d19a47c41bebcabb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uam.c,v 1.8 2002-09-29 23:29:14 sibaz Exp $
+ * $Id: uam.c,v 1.11 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 /* STDC check */
 #if STDC_HEADERS
@@ -54,8 +55,7 @@ struct uam_mod *uam_load(const char *path, const char *name)
   void *module;
 
   if ((module = mod_open(path)) == NULL) {
-    LOG(log_error, logtype_papd, "uam_load(%s): failed to load.", name);
-    LOG(log_error, logtype_papd, dlerror());
+    LOG(log_error, logtype_papd, "uam_load(%s): failed to load: %s", name, mod_error());
     return NULL;
   }
 
@@ -64,7 +64,7 @@ struct uam_mod *uam_load(const char *path, const char *name)
     goto uam_load_fail;
   }
 
-  strncpy(buf, name, sizeof(buf));
+  strlcpy(buf, name, sizeof(buf));
   if ((p = strchr(buf, '.')))
     *p = '\0';
   if ((mod->uam_fcn = mod_symbol(module, buf)) == NULL) {
@@ -113,6 +113,7 @@ int uam_register(const int type, const char *path, const char *name, ...)
 {
   va_list ap;
   struct uam_obj *uam;
+  int ret;
 
   if (!name)
     return -1;
@@ -156,13 +157,13 @@ int uam_register(const int type, const char *path, const char *name, ...)
   va_end(ap);
 
   /* attach to other uams */
-  if (auth_register(type, uam) < 0) {
+  ret = auth_register(type, uam);
+  if (ret) {
     free(uam->uam_path);
     free(uam);
-    return -1;
   }
 
-  return 0;
+  return ret;
 }
 
 void uam_unregister(const int type, const char *name)
@@ -182,15 +183,15 @@ void uam_unregister(const int type, const char *name)
 }
 
 /* Crap to support uams which call this afpd function */
-int uam_afpserver_option(void *private, const int what, void *option,
-                         int *len)
+int uam_afpserver_option(void *private _U_, const int what _U_, void *option _U_,
+                         size_t *len _U_)
 {
        return(0);
 }
 
 /* --- helper functions for plugin uams --- */
 
-struct passwd *uam_getname(char *name, const int len)
+struct passwd *uam_getname(void *dummy _U_, char *name, const int len)
 {
   struct passwd *pwent;
   char *user;