diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2007-09-14 19:44:09 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2007-09-14 19:44:09 +0000 |
commit | f645df69737893f7846e70f27d0b9ab41165078e (patch) | |
tree | 97bf6e13e657b075e0385fc72ce78c2a2afef268 /nslcd/alias.c | |
parent | bc0bac94bbefd984a83d6d62fed132337719e014 (diff) |
revert special casing for alias_byname() to other functions and some logging strings simplifications
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@394 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/alias.c')
-rw-r--r-- | nslcd/alias.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/nslcd/alias.c b/nslcd/alias.c index 0593c6d..49b0fd3 100644 --- a/nslcd/alias.c +++ b/nslcd/alias.c @@ -118,17 +118,6 @@ static enum nss_status _nss_ldap_parse_alias( return stat; } -static int write_alias(MYLDAP_SESSION *session,LDAPMessage *e,struct ldap_state UNUSED(*state),TFILE *fp) -{ - int stat; - if ((stat=_nss_ldap_write_rndvalue(fp,session,e,attmap_alias_cn))!=NSLCD_RESULT_SUCCESS) - return stat; - if ((stat=_nss_ldap_write_attrvals(fp,session,e,attmap_alias_rfc822MailMember))!=NSLCD_RESULT_SUCCESS) - return stat; - return NSLCD_RESULT_SUCCESS; -} - - /* macros for expanding the NSLCD_ALIAS macro */ #define NSLCD_STRING(field) WRITE_STRING(fp,field) #define NSLCD_STRINGLIST(field) WRITE_STRINGLIST_NUM(fp,field,result.alias_members_len) @@ -137,9 +126,14 @@ static int write_alias(MYLDAP_SESSION *session,LDAPMessage *e,struct ldap_state int nslcd_alias_byname(TFILE *fp,MYLDAP_SESSION *session) { - int32_t tmpint32; + int32_t tmpint32,tmp2int32; char name[256]; char filter[1024]; + /* these are here for now until we rewrite the LDAP code */ + struct aliasent result; + char buffer[1024]; + int errnop; + int retv; /* read request parameters */ READ_STRING_BUF2(fp,name,sizeof(name)); /* log call */ @@ -150,8 +144,15 @@ int nslcd_alias_byname(TFILE *fp,MYLDAP_SESSION *session) /* do the LDAP request */ mkfilter_alias_byname(name,filter,sizeof(filter)); alias_init(); - _nss_ldap_searchbyname(session,alias_base,alias_scope,filter,alias_attrs, - fp,write_alias); + retv=_nss_ldap_getbyname(session,&result,buffer,1024,&errnop, + alias_base,alias_scope,filter,alias_attrs, + _nss_ldap_parse_alias); + /* write the response */ + WRITE_INT32(fp,retv); + if (retv==NSLCD_RESULT_SUCCESS) + { + NSLCD_ALIAS; + } WRITE_FLUSH(fp); /* we're done */ return 0; |