]> git.sur5r.net Git - openldap/blobdiff - contrib/slapd-modules/nssov/netgroup.c
Merge remote-tracking branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / contrib / slapd-modules / nssov / netgroup.c
index 7fe781e37a87495f29372561794e15b150b4445f..bf69892a1285069ad7eb4ae7e71f15c410269a0c 100644 (file)
@@ -1,7 +1,9 @@
 /* netgroup.c - netgroup lookup routines */
 /* $OpenLDAP$ */
-/*
- * Copyright 2008 by Howard Chu, Symas Corp.
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>. 
+ *
+ * Copyright 2008-2014 The OpenLDAP Foundation.
+ * Portions Copyright 2008 by Howard Chu, Symas Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -12,7 +14,7 @@
  * top-level directory of the distribution or, alternatively, at
  * <http://www.OpenLDAP.org/license.html>.
  */
-/*
+/* ACKNOWLEDGEMENTS:
  * This code references portions of the nss-ldapd package
  * written by Arthur de Jong. The nss-ldapd code was forked
  * from the nss-ldap library written by Luke Howard.
@@ -91,7 +93,7 @@ static int write_netgroup_triple(TFILE *fp,const char *triple)
        /* we should have a bracket now */
        if (triple[i]!='(')
        {
-               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): entry does not begin with '(' (entry skipped)",0,0,0);
+               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): entry does not begin with '(' (entry skipped)\n",0,0,0);
                return 0;
        }
        i++;
@@ -101,7 +103,7 @@ static int write_netgroup_triple(TFILE *fp,const char *triple)
                /* nothing else to do */ ;
        if (triple[i]!=',')
        {
-               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): missing ',' (entry skipped)",0,0,0);
+               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): missing ',' (entry skipped)\n",0,0,0);
                return 0;
        }
        hoste=i;
@@ -112,7 +114,7 @@ static int write_netgroup_triple(TFILE *fp,const char *triple)
                /* nothing else to do */ ;
        if (triple[i]!=',')
        {
-               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): missing ',' (entry skipped)",0,0,0);
+               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): missing ',' (entry skipped)\n",0,0,0);
                return 0;
        }
        usere=i;
@@ -123,7 +125,7 @@ static int write_netgroup_triple(TFILE *fp,const char *triple)
                /* nothing else to do */ ;
        if (triple[i]!=')')
        {
-               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): missing ')' (entry skipped)",0,0,0);
+               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): missing ')' (entry skipped)\n",0,0,0);
                return 0;
        }
        domaine=i;
@@ -134,12 +136,12 @@ static int write_netgroup_triple(TFILE *fp,const char *triple)
        /* if anything is left in the string we have a problem */
        if (triple[i]!='\0')
        {
-               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): string contains trailing data (entry skipped)",0,0,0);
+               Debug(LDAP_DEBUG_ANY,"write_netgroup_triple(): string contains trailing data (entry skipped)\n",0,0,0);
                return 0;
        }
        /* write strings */
-       WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
-       WRITE_INT32(fp,NETGROUP_TYPE_TRIPLE);
+       WRITE_INT32(fp,NSLCD_RESULT_BEGIN);
+       WRITE_INT32(fp,NSLCD_NETGROUP_TYPE_TRIPLE);
        WRITE_STRING_STRIPSPACE_LEN(fp,triple+hostb,hoste-hostb)
        WRITE_STRING_STRIPSPACE_LEN(fp,triple+userb,usere-userb)
        WRITE_STRING_STRIPSPACE_LEN(fp,triple+domainb,domaine-domainb)
@@ -169,9 +171,9 @@ static int write_netgroup(nssov_netgroup_cbp *cbp,Entry *entry)
                for (i=0;i<a->a_numvals;i++)
                {
                        /* write the result code */
-                       WRITE_INT32(cbp->fp,NSLCD_RESULT_SUCCESS);
+                       WRITE_INT32(cbp->fp,NSLCD_RESULT_BEGIN);
                        /* write triple indicator */
-                       WRITE_INT32(cbp->fp,NETGROUP_TYPE_NETGROUP);
+                       WRITE_INT32(cbp->fp,NSLCD_NETGROUP_TYPE_NETGROUP);
                        /* write netgroup name */
                        if (write_string_stripspace_len(cbp->fp,a->a_vals[i].bv_val,a->a_vals[i].bv_len))
                                return -1;
@@ -188,10 +190,10 @@ NSSOV_HANDLE(
        char fbuf[1024];
        struct berval filter = {sizeof(fbuf)};
        filter.bv_val = fbuf;
-       READ_STRING_BUF2(fp,cbp.buf,sizeof(cbp.buf));,
+       READ_STRING(fp,cbp.buf);,
        cbp.name.bv_len = tmpint32;
        cbp.name.bv_val = cbp.buf;
-       Debug(LDAP_DEBUG_TRACE,"nssov_netgroup_byname(%s)",cbp.name.bv_val,0,0);,
+       Debug(LDAP_DEBUG_TRACE,"nssov_netgroup_byname(%s)\n",cbp.name.bv_val,0,0);,
        NSLCD_ACTION_NETGROUP_BYNAME,
        nssov_filter_byname(cbp.mi,0,&cbp.name,&filter)
 )