[PATCH HEAD] --with-ldapsam integer problem (uidNumber and rid)

Ignacio Coupeau icoupeau at unav.es
Wed Dec 19 10:27:05 GMT 2001


Because some functions changes between HEAD and SAMBA_2_2:
(2001/12/19, 14:00 GMT) 

>SAMBA_2_2/samba/source/include/proto.h:uid_t pdb_get_uid (SAM_ACCOUNT *sampass);
>SAMBA_HEAD/samba/source/include/proto.h:uid_t *pdb_get_uid (const SAM_ACCOUNT *sampass);

I include some possible fixes for "pdb_get_uid(sampass)" replacement by
"*pdb_get_uid(sampass)" in several places.
Also some cast (uint32 *) may be useful.

diff -u  passdb/pdb_ldap.c-DIST  passdb/pdb_ldap.c
--- passdb/pdb_ldap.c-DIST      Wed Dec 19 14:24:57 2001
+++ passdb/pdb_ldap.c   Wed Dec 19 21:11:14 2001
@@ -540,7 +540,9 @@
        /* not sure about using this for the nt_username */
        make_a_mod(mods, ldap_state, "sambaDomain",
pdb_get_domain(sampass));
 
-       slprintf(temp, sizeof(temp) - 1, "%i", pdb_get_uid(sampass));
+       //slprintf(temp, sizeof(temp) - 1, "%i", pdb_get_uid(sampass));
+       slprintf(temp, sizeof(temp) - 1, "%li", *pdb_get_uid(sampass));
+       DEBUG(2, ("Setting entry for uidNumber: %s\n", temp));
        make_a_mod(mods, ldap_state, "uidNumber", temp);
 
        slprintf (temp, sizeof (temp) - 1, "%li",
pdb_get_pass_last_set_time(sampass));
@@ -578,18 +580,18 @@
        make_a_mod(mods, ldap_state, "userWorkstations",
pdb_get_workstations(sampass));
 
        if ( !sampass->user_rid)
-               sampass->user_rid =
pdb_uid_to_user_rid(pdb_get_uid(sampass));
+               sampass->user_rid =
pdb_uid_to_user_rid(*pdb_get_uid(sampass));
        slprintf(temp, sizeof(temp) - 1, "%i", sampass->user_rid);
        make_a_mod(mods, ldap_state, "rid", temp);
 
        if ( !sampass->group_rid) {
                GROUP_MAP map;
 
-               if (get_group_map_from_gid(pdb_get_gid(sampass), &map,
MAPPING_WITHOUT_PRIV)) {
-                       sid_peek_rid(&map.sid, &sampass->group_rid);
+               if (get_group_map_from_gid(*pdb_get_gid(sampass), &map,
MAPPING_WITHOUT_PRIV)) {
+                       sid_peek_rid(&map.sid,(uint32
*)&sampass->group_rid);
                }
                else 
-                       sampass->group_rid =
pdb_gid_to_group_rid(pdb_get_gid(sampass));
+                       sampass->group_rid =
pdb_gid_to_group_rid(*pdb_get_gid(sampass));
        }
 
        slprintf(temp, sizeof(temp) - 1, "%i", sampass->group_rid);
--------

Ignacio Coupeau wrote:
> 
> In the latest CVS HEAD (with RH 7.1, Intel) i found thatr with the
> smbpasswd -a -m <machine_account>

> ---
> *********************************************************************/
> static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass,
>                    LDAP * ldap_struct, LDAPMessage * entry)
> {
> ---
> 
> some uid conversion has been damaged recently, because the uidNumber (in
> this example, 531) and the rid (about 1062) in the init_sam_from_ldap:
> 
> -----> init_ldap_from_sam
> Setting entry for user: grabador$
> --> init_ldap_from_sam: uidNumber 135149184 135149184 135149184,
> 135149184
> --> init_ldap_from_sam: rid 270299368 270299368 270299368, 270299368
> --
> and stored in the ldap as 135149184 , 270299368  and the ldap account is
> broken.
> 
> If not passwd is replaced, the accounts runs well.


-- 
____________________________________________________
Ignacio Coupeau, Ph.D.     e-mail: icoupeau at unav.es
CTI, Director              fax:    948 425619
University of Navarra      voice:  948 425600
Pamplona, SPAIN            http://www.unav.es/cti/




More information about the samba-technical mailing list