lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1949 - nss-pam-ldapd-0.8/tests

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

nss-pam-ldapd commit: r1949 - nss-pam-ldapd-0.8/tests



Author: arthur
Date: Sun Apr 28 22:20:47 2013
New Revision: 1949
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1949&view=revision

Log:
do not rely on printf() being able to print NULL strings (8790b40 from 0.9)

Modified:
   nss-pam-ldapd-0.8/tests/test_myldap.c

Modified: nss-pam-ldapd-0.8/tests/test_myldap.c
==============================================================================
--- nss-pam-ldapd-0.8/tests/test_myldap.c       Sun Apr 28 16:56:04 2013        
(r1948)
+++ nss-pam-ldapd-0.8/tests/test_myldap.c       Sun Apr 28 22:20:47 2013        
(r1949)
@@ -2,7 +2,7 @@
    test_myldap.c - simple test for the myldap module
    This file is part of the nss-pam-ldapd library.
 
-   Copyright (C) 2007, 2008, 2009, 2011 Arthur de Jong
+   Copyright (C) 2007, 2008, 2009, 2011, 2012, 2013 Arthur de Jong
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -207,6 +207,7 @@
   const char *attrs[] = { "cn", "uid", NULL };
   int rc;
   char buf[80];
+  const char *rdnval;
   /* initialize session */
   printf("test_myldap: test_get_rdnvalues(): getting session...\n");
   session=myldap_create_session();
@@ -223,15 +224,21 @@
   assert(entry!=NULL);
   printf("test_myldap: test_get_rdnvalues(): got DN 
%s\n",myldap_get_dn(entry));
   /* get some values from DN */
-  printf("test_myldap: test_get_rdnvalues(): 
DN.uid=%s\n",myldap_get_rdn_value(entry,"uid"));
-  printf("test_myldap: test_get_rdnvalues(): 
DN.cn=%s\n",myldap_get_rdn_value(entry,"cn"));
-  printf("test_myldap: test_get_rdnvalues(): 
DN.uidNumber=%s\n",myldap_get_rdn_value(entry,"uidNumber"));
+  rdnval=myldap_get_rdn_value(entry,"uid");
+  printf("test_myldap: test_get_rdnvalues(): 
DN.uid=%s\n",rdnval==NULL?"NULL":rdnval);
+  rdnval=myldap_get_rdn_value(entry,"cn");
+  printf("test_myldap: test_get_rdnvalues(): 
DN.cn=%s\n",rdnval==NULL?"NULL":rdnval);
+  rdnval=myldap_get_rdn_value(entry,"uidNumber");
+  printf("test_myldap: test_get_rdnvalues(): 
DN.uidNumber=%s\n",rdnval==NULL?"NULL":rdnval);
   /* clean up */
   myldap_session_close(session);
   /* some tests */
-  printf("test_myldap: test_get_rdnvalues(): 
DN.uid=%s\n",myldap_cpy_rdn_value("cn=Aka 
Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld","uid",buf,sizeof(buf)));
-  printf("test_myldap: test_get_rdnvalues(): 
DN.cn=%s\n",myldap_cpy_rdn_value("cn=Aka 
Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld","cn",buf,sizeof(buf)));
-  printf("test_myldap: test_get_rdnvalues(): 
DN.uidNumber=%s\n",myldap_cpy_rdn_value("cn=Aka 
Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld","uidNumber",buf,sizeof(buf)));
+  rdnval=myldap_cpy_rdn_value("cn=Aka 
Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld","uid",buf,sizeof(buf));
+  printf("test_myldap: test_get_rdnvalues(): 
DN.uid=%s\n",rdnval==NULL?"NULL":rdnval);
+  rdnval=myldap_cpy_rdn_value("cn=Aka 
Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld","cn",buf,sizeof(buf));
+  printf("test_myldap: test_get_rdnvalues(): 
DN.cn=%s\n",rdnval==NULL?"NULL":rdnval);
+  rdnval=myldap_cpy_rdn_value("cn=Aka 
Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld","uidNumber",buf,sizeof(buf));
+  printf("test_myldap: test_get_rdnvalues(): 
DN.uidNumber=%s\n",rdnval==NULL?"NULL":rdnval);
 }
 
 /* this method tests to see if we can perform two searches within
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/