text-base idmap patch

Stefan (metze) Metzmacher metze at samba.org
Wed Mar 24 13:24:04 GMT 2004


Takashi Ikebe wrote:

> Hi,
> I made idmap patch based on samba 3.0.2a.
> Attached patch maps sid to gid/uid with text base database.
> The ldap server is good for big network, however small network does
> not need such database.
> By using this patch, you can use same uid with nis with text-base
> configuration.
> 
> Text base user database should be named as "smbidmap" and should be
> placed on /etc/samba/smbidmap.
> Format is below;
> SID id(uid/gid) type(uid=1,gid=2)
> for instance,
> S-1-5-21-2581315262-1086050687-3579556021-**** 1012 1
> This mean S-1-5-21-2581315262-1086050687-3579556021-**** is user's SID
> and uid is 1012.
> 
> I don't know this kind of patch is welcome, however I need this
> function for my environment.

Hi,

why haven't written this as idmap module?

try to add a file sam/idmap_text.c and put all stuff in there.

you need something like this at the end of the file:

static struct idmap_methods text_methods = {
	text_idmap_init,
	text_allocate_rid,
	text_allocate_id,
	text_get_sid_from_id,
	text_get_id_from_sid,
	text_set_mapping,
	text_idmap_close,
	text_idmap_status
};

NTSTATUS idmap_ldap_init(void)
{
	return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "text", 
&text_methods);
}

above of this you just need to implement your versions of the 
text_idmap_init,text_allocate_rid,text_allocate_id,text_get_sid_from_id,text_get_id_from_sid,text_set_mapping,text_idmap_close,text_idmap_status
functions...

take a look at include/idmap.h and and sam/idmap_ldap.c for the 
prototypes of this functions

you later can choose your backend by "idmap backend = text" in smb.conf



-- 
metze

Stefan Metzmacher <metze at samba.org> www.samba.org


More information about the samba-technical mailing list