From c53c14bcbe2f2af12fba7c693eb5f4862f6f2b40 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Thu, 28 Jul 2011 16:36:21 +0200 Subject: [PATCH] Fix a crash when searching for a UUID that is not a special local UUID and LDAP support is not compiled in. NetAPF bug #10149. --- NEWS | 2 ++ etc/afpd/acls.c | 2 +- libatalk/acl/uuid.c | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 705cd05f..21525dde 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ Changes in 2.2.1 new connection attempts * FIX: afpd: fix undefined behaviour when more then ~510 connetions where established +* FIX: afpd: fix a crash when searching for a UUID that is not a special + local UUID and LDAP support is not compiled in * FIX: cnid_dbd: increase BerkeleyDB locks and lockobjs * FIX: cnid_dbd: implement -d option, deletes CNID db * FIX: suse: initscript return better status diff --git a/etc/afpd/acls.c b/etc/afpd/acls.c index b91de9f2..7bbec02c 100644 --- a/etc/afpd/acls.c +++ b/etc/afpd/acls.c @@ -1119,7 +1119,7 @@ static int check_acl_access(const struct vol *vol, cfrombstr(dir->d_fullpath), path, getcwdpath(), requested_rights); /* Get uid or gid from UUID */ - EC_ZERO_LOG_ERR(getnamefromuuid(uuid, &username, &uuidtype), AFPERR_PARAM); + EC_ZERO_ERR(getnamefromuuid(uuid, &username, &uuidtype), AFPERR_PARAM); EC_ZERO_LOG_ERR(lstat(path, &st), AFPERR_PARAM); switch (uuidtype) { diff --git a/libatalk/acl/uuid.c b/libatalk/acl/uuid.c index fc64c045..3bf591e5 100644 --- a/libatalk/acl/uuid.c +++ b/libatalk/acl/uuid.c @@ -215,7 +215,7 @@ cleanup: * Caller must free name appropiately. */ int getnamefromuuid(const uuidp_t uuidp, char **name, uuidtype_t *type) { - int ret = 0; + int ret; uid_t uid; gid_t gid; struct passwd *pwd; @@ -270,13 +270,16 @@ int getnamefromuuid(const uuidp_t uuidp, char **name, uuidtype_t *type) { #ifdef HAVE_LDAP ret = ldap_getnamefromuuid(uuid_bin2string(uuidp), name, type); +#else + ret = -1; +#endif + if (ret != 0) { - LOG(log_warning, logtype_afpd, "getnamefromuuid(%s): no result from ldap_getnamefromuuid", + LOG(log_debug, logtype_afpd, "getnamefromuuid(%s): not found", uuid_bin2string(uuidp)); add_cachebyuuid(uuidp, "UUID_ENOENT", UUID_ENOENT, 0); return -1; } -#endif add_cachebyuuid(uuidp, *name, *type, 0); -- 2.39.2