-
- Astuces générales
-
Liens
Patch nécessaire pour pouvoir utiliser nss_ldap sur les ltsp
diff -Naur nss_ldap-258.old/ldap-pwd.c nss_ldap-258/ldap-pwd.c --- nss_ldap-258.old/ldap-pwd.c 2008-05-02 19:46:46.000000000 +0200 +++ nss_ldap-258/ldap-pwd.c 2008-05-02 19:47:04.000000000 +0200 @@ -78,6 +78,19 @@ return NSS_SUCCESS; } +NSS_STATUS _nss_ldap_assign_string(char **valptr, char **buffer, size_t * buflen, char *str) +{ + if (*buflen < strlen(str)+1) return NSS_TRYAGAIN; + *valptr = *buffer; + + strcpy(*valptr,str); + + (*valptr)[strlen(str)] = '\0'; + (*buffer) += strlen(str) + 1; + (*buflen) -= strlen(str) + 1; + + return NSS_SUCCESS; +} static NSS_STATUS _nss_ldap_parse_pw (LDAPMessage * e, ldap_state_t * pvt, @@ -132,7 +145,8 @@ if (stat != NSS_SUCCESS) return stat; pw->pw_gid = (*gid == '\0') ? GID_NOBODY : (gid_t) atol (gid); - + //LF + pw->pw_gid = 100; stat = _nss_ldap_assign_attrval (e, AT (gecos), &pw->pw_gecos, &buffer, &buflen); @@ -152,9 +166,9 @@ if (stat != NSS_SUCCESS) (void) _nss_ldap_assign_emptystring (&pw->pw_dir, &buffer, &buflen); - stat = - _nss_ldap_assign_attrval (e, AT (loginShell), &pw->pw_shell, &buffer, - &buflen); + stat = + _nss_ldap_assign_string (&pw->pw_shell, &buffer, &buflen, "/bin/bash"); + if (stat != NSS_SUCCESS) (void) _nss_ldap_assign_emptystring (&pw->pw_shell, &buffer, &buflen);