"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/test_cfg.c" between
nss-pam-ldapd-0.9.11.tar.gz and nss-pam-ldapd-0.9.12.tar.gz

About: nss-pam-ldapd is a Name Service Switch (NSS) module and Pluggable Authentication Module (PAM) that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS. It also allows you to do authentication to an LDAP server.

test_cfg.c  (nss-pam-ldapd-0.9.11):test_cfg.c  (nss-pam-ldapd-0.9.12)
/* /*
test_cfg.c - simple test for the cfg module test_cfg.c - simple test for the cfg module
This file is part of the nss-pam-ldapd library. This file is part of the nss-pam-ldapd library.
Copyright (C) 2007, 2009, 2011, 2012, 2013 Arthur de Jong Copyright (C) 2007-2021 Arthur de Jong
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
skipping to change at line 190 skipping to change at line 190
str = get_strdup(__FILE__, __LINE__, __PRETTY_FUNCTION__, &line); str = get_strdup(__FILE__, __LINE__, __PRETTY_FUNCTION__, &line);
assertstreq(str, "is"); assertstreq(str, "is");
i = get_int(__FILE__, __LINE__, __PRETTY_FUNCTION__, &line); i = get_int(__FILE__, __LINE__, __PRETTY_FUNCTION__, &line);
assert(i == 1); assert(i == 1);
str = get_linedup(__FILE__, __LINE__, __PRETTY_FUNCTION__, &line); str = get_linedup(__FILE__, __LINE__, __PRETTY_FUNCTION__, &line);
assertstreq(str, "simple line"); assertstreq(str, "simple line");
get_eol(__FILE__, __LINE__, __PRETTY_FUNCTION__, &line); get_eol(__FILE__, __LINE__, __PRETTY_FUNCTION__, &line);
} }
extern const char *passwd_bases[]; extern const char *passwd_bases[];
extern const char *group_bases[];
extern const char *group_filter; extern const char *group_filter;
extern int passwd_scope; extern int passwd_scope;
static void test_read(void) static void test_read(void)
{ {
FILE *fp; FILE *fp;
struct ldap_config cfg; struct ldap_config cfg;
/* write some stuff to a temporary file */ /* write some stuff to a temporary file */
fp = fopen("temp.cfg", "w"); fp = fopen("temp.cfg", "w");
assert(fp != NULL); assert(fp != NULL);
fprintf(fp, "# a line of comments\n" fprintf(fp, "# a line of comments\n"
"uri ldap://127.0.0.1/\n" "uri ldap://127.0.0.1/\n"
"uri ldap:/// ldaps://127.0.0.1/\n" "uri ldap:/// ldaps://127.0.0.1/\n"
"base dc=test, dc=tld\n" "base dc=test, dc=tld\n"
"base passwd ou=Some People,dc=test,dc=tld\n" "base passwd ou=Some People,dc=test,dc=tld\n"
"base group \"\"\n"
"map\tpasswd uid\t\tsAMAccountName\n" "map\tpasswd uid\t\tsAMAccountName\n"
"map passwd homeDirectory \"${homeDirectory:-/home/$uid}\" \n" "map passwd homeDirectory \"${homeDirectory:-/home/$uid}\" \n"
"map passwd gecos \"${givenName}. ${sn}\"\n" "map passwd gecos \"${givenName}. ${sn}\"\n"
"filter group (&(objeclClass=posixGroup)(gid=1*))\n" "filter group (&(objeclClass=posixGroup)(gid=1*))\n"
"\n" "\n"
"scope passwd one\n" "scope passwd one\n"
"cache dn2uid 10m 1s\n"); "cache dn2uid 10m 1s\n");
fclose(fp); fclose(fp);
/* parse the file */ /* parse the file */
cfg_defaults(&cfg); cfg_defaults(&cfg);
skipping to change at line 226 skipping to change at line 228
/* check results */ /* check results */
assert(cfg.uris[0].uri != NULL); assert(cfg.uris[0].uri != NULL);
assert(cfg.uris[1].uri != NULL); assert(cfg.uris[1].uri != NULL);
assert(cfg.uris[2].uri != NULL); assert(cfg.uris[2].uri != NULL);
assertstreq(cfg.uris[0].uri, "ldap://127.0.0.1/"); assertstreq(cfg.uris[0].uri, "ldap://127.0.0.1/");
assertstreq(cfg.uris[1].uri, "ldap:///"); assertstreq(cfg.uris[1].uri, "ldap:///");
assertstreq(cfg.uris[2].uri, "ldaps://127.0.0.1/"); assertstreq(cfg.uris[2].uri, "ldaps://127.0.0.1/");
assert(cfg.uris[3].uri == NULL); assert(cfg.uris[3].uri == NULL);
assertstreq(cfg.bases[0], "dc=test, dc=tld"); assertstreq(cfg.bases[0], "dc=test, dc=tld");
assertstreq(passwd_bases[0], "ou=Some People,dc=test,dc=tld"); assertstreq(passwd_bases[0], "ou=Some People,dc=test,dc=tld");
assertstreq(group_bases[0], "");
assertstreq(attmap_passwd_uid, "sAMAccountName"); assertstreq(attmap_passwd_uid, "sAMAccountName");
assertstreq(attmap_passwd_homeDirectory, "\"${homeDirectory:-/home/$uid}\""); assertstreq(attmap_passwd_homeDirectory, "\"${homeDirectory:-/home/$uid}\"");
assertstreq(attmap_passwd_gecos, "\"${givenName}. ${sn}\""); assertstreq(attmap_passwd_gecos, "\"${givenName}. ${sn}\"");
assertstreq(group_filter, "(&(objeclClass=posixGroup)(gid=1*))"); assertstreq(group_filter, "(&(objeclClass=posixGroup)(gid=1*))");
assert(passwd_scope == LDAP_SCOPE_ONELEVEL); assert(passwd_scope == LDAP_SCOPE_ONELEVEL);
assert(cfg.cache_dn2uid_positive == 10 * 60); assert(cfg.cache_dn2uid_positive == 10 * 60);
assert(cfg.cache_dn2uid_negative == 1); assert(cfg.cache_dn2uid_negative == 1);
/* remove temporary file */ /* remove temporary file */
remove("temp.cfg"); remove("temp.cfg");
} }
 End of changes. 4 change blocks. 
1 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)