Port to Debian Buster and OpenAFS 1.8
[hcoop/debian/libnss-afs.git] / nss_afs.c
index fef20d9..a9326d4 100644 (file)
--- a/nss_afs.c
+++ b/nss_afs.c
@@ -40,6 +40,7 @@
 #include <fcntl.h>
 #include <getopt.h>
 #include <grp.h>
+#include <limits.h>
 #include <netinet/in.h>
 #include <nss.h>
 #include <pthread.h>
@@ -62,6 +63,7 @@
 #include <afs/param.h>
 #include <afs/ptclient.h>
 #include <afs/pterror.h>
+#include <afs/ptuser.h>
 #include <afs/stds.h>
 
 #define HOMEDIR_AUTO      0
@@ -86,12 +88,14 @@ extern struct ubik_client *pruclient;
 
 int  afs_initialized = 0;
 char cellname[MAXCELLNAMELEN];
-char homedir_prefix[MAXPATHLEN];
-char cell_root[MAXPATHLEN];
+char homedir_prefix[PATH_MAX];
+char cell_root[PATH_MAX];
 int  homedir_prefix_len=0;
 char homedirs_method=0;
 char shells_method=0;
 
+int init_afs ();
+
 /**
  *  The cpstr() function copies a null-terminated string from str*
  *  (the first argument) into buf and updates both buf and buflen.  If
@@ -110,7 +114,7 @@ int cpstr( char *str, char **buf, size_t *buflen) {
 /**
  * Look up the name corresponding to uid, store in buffer.
  */
-enum nss_status ptsid2name(int uid, char **buffer, int *buflen) {
+enum nss_status ptsid2name(int uid, char **buffer, size_t *buflen) {
   int ret, i;
   idlist lid;
   namelist lnames;
@@ -129,7 +133,7 @@ enum nss_status ptsid2name(int uid, char **buffer, int *buflen) {
   lnames.namelist_val = 0;
   lnames.namelist_len = 0;
 
-  if (ubik_Call(PR_IDToName,pruclient,0,&lid,&lnames) != PRSUCCESS) {
+  if (ubik_PR_IDToName(pruclient,0,&lid,&lnames) != PRSUCCESS) {
     perror("ubik_Call() in ptsid2name() failed\n");
     pthread_mutex_unlock(&mutex);
     return NSS_STATUS_UNAVAIL;
@@ -177,7 +181,7 @@ enum nss_status ptsname2id(char *name, uid_t* uid) {
   strncpy(uname, name, MAXUSERNAMELEN);
   lnames.namelist_len = 1;
 
-  if (ubik_Call(PR_NameToID,pruclient,0,&lnames,&lid) != PRSUCCESS) {
+  if (ubik_PR_NameToID(pruclient,0,&lnames,&lid) != PRSUCCESS) {
     perror("ubik_Call() in ptsname2id() failed\n");
     pthread_mutex_unlock(&mutex);
     return NSS_STATUS_UNAVAIL;
@@ -324,7 +328,7 @@ int get_shell(char *name, char **buffer, size_t *buflen) {
   int temp;
   char *b;
   char* bufx = buf;
-  int bufxlen = 256;
+  size_t bufxlen = 256;
   b=*buffer;
 
   switch (shells_method) {