summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2013-03-28 22:46:15 +0100
committerArthur de Jong <arthur@arthurdejong.org>2013-03-28 23:55:13 +0100
commit8790b4070a62f391aa189e6450b6b597b86ec1cd (patch)
tree576704ae33b8ac07ac39864c9b5b5a6315f4e3a7 /tests
parent932c641bb17c7e19a11ad9f4c771c01cd0592bef (diff)
Do not rely on printf() being able to print NULL strings
Diffstat (limited to 'tests')
-rw-r--r--tests/test_myldap.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/test_myldap.c b/tests/test_myldap.c
index 4239082..d95157f 100644
--- a/tests/test_myldap.c
+++ b/tests/test_myldap.c
@@ -208,6 +208,7 @@ static void test_get_rdnvalues(void)
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,24 +224,30 @@ static void test_get_rdnvalues(void)
printf("test_myldap: test_get_rdnvalues(): got DN %s\n",
myldap_get_dn(entry));
/* get some values from DN */
+ rdnval = myldap_get_rdn_value(entry, "uid");
printf("test_myldap: test_get_rdnvalues(): DN.uid=%s\n",
- myldap_get_rdn_value(entry, "uid"));
+ rdnval == NULL ? "NULL" : rdnval);
+ rdnval = myldap_get_rdn_value(entry, "cn");
printf("test_myldap: test_get_rdnvalues(): DN.cn=%s\n",
- myldap_get_rdn_value(entry, "cn"));
+ rdnval == NULL ? "NULL" : rdnval);
+ rdnval = myldap_get_rdn_value(entry, "uidNumber");
printf("test_myldap: test_get_rdnvalues(): DN.uidNumber=%s\n",
- myldap_get_rdn_value(entry, "uidNumber"));
+ rdnval == NULL ? "NULL" : rdnval);
/* clean up */
myldap_session_close(session);
/* some tests */
+ 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",
- myldap_cpy_rdn_value("cn=Aka Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld",
- "uid", buf, sizeof(buf)));
+ 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",
- myldap_cpy_rdn_value("cn=Aka Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld",
- "cn", buf, sizeof(buf)));
+ 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",
- myldap_cpy_rdn_value("cn=Aka Ashbach+uid=aashbach,ou=lotsofpeople,dc=test,dc=tld",
- "uidNumber", buf, sizeof(buf)));
+ rdnval == NULL ? "NULL" : rdnval);
}
/* this method tests to see if we can perform two searches within