From ead6827240fcc37aacc0d5faa778b9cee3964576 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Mon, 17 May 2010 13:54:26 +0000 Subject: [PATCH] - switch to the upstream patch for #592411 (same effect, but slightly different) --- nss-pam-ldapd-default.patch | 48 +++++++++++++++++++++++++++++++++---- nss-pam-ldapd.spec | 5 +++- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/nss-pam-ldapd-default.patch b/nss-pam-ldapd-default.patch index 6fa691d..86f9bad 100644 --- a/nss-pam-ldapd-default.patch +++ b/nss-pam-ldapd-default.patch @@ -4,13 +4,51 @@ the desired value from the entry. Index: nslcd/attmap.c =================================================================== --- nslcd/attmap.c (revision 1110) -+++ nslcd/attmap.c (working copy) -@@ -254,6 +254,8 @@ - MUST_USE const char *attmap_get_value(MYLDAP_ENTRY *entry,const char *attr,char *buffer,size_t buflen) ++++ nslcd/attmap.c (revision 1111) +@@ -251,20 +251,25 @@ + return values[0]; + } + +-MUST_USE const char *attmap_get_value(MYLDAP_ENTRY *entry,const char *attr,char *buffer,size_t buflen) ++const char *attmap_get_value(MYLDAP_ENTRY *entry,const char *attr,char *buffer,size_t buflen) { const char **values; -+ if (buflen > 0) -+ buffer[0]='\0'; ++ /* check and clear buffer */ ++ if ((buffer==NULL)||(buflen<=0)) ++ return NULL; ++ buffer[0]='\0'; /* for simple values just return the attribute */ if (attr[0]!='"') { + values=myldap_get_values(entry,attr); +- if (values==NULL) ++ if ((values==NULL)||(values[0]==NULL)) + return NULL; + strncpy(buffer,values[0],buflen); + buffer[buflen-1]='\0'; + return buffer; + /* TODO: maybe warn when multiple values are found */ + } ++ /* we have an expression, try to parse */ + if ( (attr[strlen(attr)-1]!='"') || + (expr_parse(attr+1,buffer,buflen,entry_expand,(void *)entry)==NULL) ) + { +Index: nslcd/attmap.h +=================================================================== +--- nslcd/attmap.h (revision 1110) ++++ nslcd/attmap.h (revision 1111) +@@ -86,11 +86,11 @@ + + /* Set the attribute mapping of the variable to the value specified. + Returns the new value on success. */ ++MUST_USE const char *attmap_set_mapping(const char **var,const char *value); + +-const char *attmap_set_mapping(const char **var,const char *value); +- + /* Return a value for the attribute, handling the case where attr +- is an expression. */ ++ is an expression. On error (e.g. problem parsing expression, attribute ++ value not found) it returns NULL and the buffer is made empty. */ + const char *attmap_get_value(MYLDAP_ENTRY *entry,const char *attr,char *buffer,size_t buflen); + + /* Add the attributes from attr to the set. The attr argumenent diff --git a/nss-pam-ldapd.spec b/nss-pam-ldapd.spec index 14c6026..01457c4 100644 --- a/nss-pam-ldapd.spec +++ b/nss-pam-ldapd.spec @@ -1,6 +1,6 @@ Name: nss-pam-ldapd Version: 0.7.5 -Release: 2%{?dist} +Release: 3%{?dist} Summary: An nsswitch module which uses directory servers Group: System Environment/Base License: LGPLv2+ @@ -157,6 +157,9 @@ fi exit 0 %changelog +* Mon May 17 2010 Nalin Dahyabhai 0.7.5-3 +- switch to the upstream patch for #592411 + * Fri May 14 2010 Nalin Dahyabhai 0.7.5-2 - don't return an uninitialized buffer as the value for an optional attribute that isn't present in the directory server entry (#592411)