rfc2307 specification of gidNumber/uidNumber
Vince Brimhall
vbrimhall at novell.com
Tue Jan 11 17:43:06 GMT 2005
Linux kernel types for uid/gid are 32 bit unsigned while rfc2307 defines
uidNumber/gidNumber as 32 bit signed values. This can result in errors
reported by the LDAP server when launching queries for a large uid/gid
since
the query string is built using %u or %lu. The patch that follows
modifies
queries to use %d.
Regards,
Vince Brimhall
--- source/sam/idmap_ldap.c
+++ source/sam/idmap_ldap.c 2005-01-07 14:39:20.185520163 -0700
@@ -71,7 +71,7 @@
else
fstrcpy( type, get_attr_key2string( sidmap_attr_list,
LDAP_ATTR_GIDNUMBER ) );
- pstr_sprintf(id_str, "%lu", ((id_type & ID_USERID) ? (unsigned
long)id.uid :
+ pstr_sprintf(id_str, "%d", ((id_type & ID_USERID) ? (unsigned
long)id.uid :
(unsigned
long)id.gid));
smbldap_set_mod( &mods, LDAP_MOD_ADD, "objectClass",
LDAP_OBJ_IDMAP_ENTRY );
@@ -450,7 +450,7 @@
}
}
- pstr_sprintf(new_id_str, "%lu",
+ pstr_sprintf(new_id_str, "%d",
((id_type & ID_USERID) ? (unsigned long)id->uid :
(unsigned long)id->gid) + 1);
@@ -503,7 +503,7 @@
type = get_attr_key2string( idpool_attr_list,
LDAP_ATTR_GIDNUMBER );
pstrcpy( suffix, lp_ldap_idmap_suffix() );
- pstr_sprintf(filter, "(&(objectClass=%s)(%s=%lu))",
+ pstr_sprintf(filter, "(&(objectClass=%s)(%s=%d))",
LDAP_OBJ_IDMAP_ENTRY, type,
((id_type & ID_USERID) ? (unsigned long)id.uid :
(unsigned long)id.gid));
@@ -703,8 +703,8 @@
return NT_STATUS_UNSUCCESSFUL;
}
- fstr_sprintf( uid_str, "%lu", (unsigned long)luid );
- fstr_sprintf( gid_str, "%lu", (unsigned long)lgid );
+ fstr_sprintf( uid_str, "%d", (unsigned long)luid );
+ fstr_sprintf( gid_str, "%d", (unsigned long)lgid );
smbldap_set_mod( &mods, LDAP_MOD_ADD, "objectClass",
LDAP_OBJ_IDPOOL );
smbldap_set_mod( &mods, LDAP_MOD_ADD,
--- source/passdb/pdb_ldap.c
+++ source/passdb/pdb_ldap.c 2005-01-07 10:51:04.604942543 -0700
@@ -2214,7 +2214,7 @@
{
pstring filter;
- pstr_sprintf(filter, "(&(objectClass=%s)(%s=%lu))",
+ pstr_sprintf(filter, "(&(objectClass=%s)(%s=%d))",
LDAP_OBJ_GROUPMAP,
get_attr_key2string(groupmap_attr_list,
LDAP_ATTR_GIDNUMBER),
(unsigned long)gid);
@@ -2254,7 +2254,7 @@
{
pstring filter;
- pstr_sprintf(filter,
"(&(|(objectClass=%s)(objectclass=%s))(%s=%lu))",
+ pstr_sprintf(filter,
"(&(|(objectClass=%s)(objectclass=%s))(%s=%d))",
LDAP_OBJ_POSIXGROUP, LDAP_OBJ_IDMAP_ENTRY,
get_attr_key2string(groupmap_attr_list,
LDAP_ATTR_GIDNUMBER),
(unsigned long)gid);
@@ -2307,7 +2307,7 @@
ldap_msgfree(result);
pstrcpy( suffix, lp_ldap_idmap_suffix() );
- pstr_sprintf(filter, "(&(objectClass=%s)(%s=%u))",
+ pstr_sprintf(filter, "(&(objectClass=%s)(%s=%d))",
LDAP_OBJ_IDMAP_ENTRY,
LDAP_ATTRIBUTE_GIDNUMBER,
map->gid);
More information about the samba-technical
mailing list