lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1791 - in nss-pam-ldapd: . nss

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1791 - in nss-pam-ldapd: . nss



Author: arthur
Date: Sat Oct 13 23:08:59 2012
New Revision: 1791
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1791&view=revision

Log:
in ether handling only write to output values and return correct error for 
buffer too small

Modified:
   nss-pam-ldapd/HACKING
   nss-pam-ldapd/nss/ethers.c

Modified: nss-pam-ldapd/HACKING
==============================================================================
--- nss-pam-ldapd/HACKING       Sat Oct 13 23:05:07 2012        (r1790)
+++ nss-pam-ldapd/HACKING       Sat Oct 13 23:08:59 2012        (r1791)
@@ -137,7 +137,9 @@
 Earlier versions of Solaris expected the NSS functions to return the binary
 representation of the lookups (e.g. struct passwd) but later versions expect a
 string representation of the data to be returned (just like a single line out
-of /etc/passwd was read).
+of /etc/passwd was read) but only if running from nscd. If args->buf.result
+is NULL a string representation is requested (except for ether by address
+lookup which is special).
 
 Source and documentation pointers for Solaris NSS:
 http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/nsswitch/

Modified: nss-pam-ldapd/nss/ethers.c
==============================================================================
--- nss-pam-ldapd/nss/ethers.c  Sat Oct 13 23:05:07 2012        (r1790)
+++ nss-pam-ldapd/nss/ethers.c  Sat Oct 13 23:08:59 2012        (r1791)
@@ -119,25 +119,26 @@
     res=snprintf(NSS_ARGS(args)->buf.buffer,NSS_ARGS(args)->buf.buflen,
                  "%s %s",ether_ntoa(&result.e_addr),result.e_name);
     if ((res<0)||(res>=NSS_ARGS(args)->buf.buflen))
-      return NSS_STR_PARSE_PARSE;
+    {
+      NSS_ARGS(args)->erange=1;
+      return NSS_NOTFOUND;
+    }
     NSS_ARGS(args)->returnval=NSS_ARGS(args)->buf.buffer;
     NSS_ARGS(args)->returnlen=strlen(NSS_ARGS(args)->returnval);
-    NSS_ARGS(args)->buf.result=NULL;
     return NSS_SUCCESS;
   }
-#endif /* not HAVE_STRUCT_NSS_XBYY_ARGS_RETURNLEN */
+#endif /* HAVE_STRUCT_NSS_XBYY_ARGS_RETURNLEN */
   /* return the result entry */
   if (wantname)
   {
+    /* we expect the buffer to have enough room for the name (buflen==0) */
     strcpy(NSS_ARGS(args)->buf.buffer,result.e_name);
-    
NSS_ARGS(args)->returnval=NSS_ARGS(args)->buf.result=NSS_ARGS(args)->buf.buffer;
-    NSS_ARGS(args)->buf.buflen=strlen(NSS_ARGS(args)->returnval);
+    NSS_ARGS(args)->returnval=NSS_ARGS(args)->buf.buffer;
   }
   else /* address */
   {
     memcpy(NSS_ARGS(args)->buf.result,&result.e_addr,sizeof(result.e_addr));
     NSS_ARGS(args)->returnval=NSS_ARGS(args)->buf.result;
-    NSS_ARGS(args)->buf.result=NULL;
   }
   return NSS_SUCCESS;
 }
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/