How to obtain username in idmap_tdb2 script?

Jiří Šašek - Solaris Prague jiri.sasek at oracle.com
Mon Mar 25 11:48:23 UTC 2024


Hello experts,
I tried a script like:

#!/bin/bash

case $1 in
   SIDTOID)
     echo $1 $2 >> /var/samba/log/idmap_script
     name=`/usr/bin/wbinfo -s $2`
     echo resolved $name >> /var/samba/log/idmap_script
...

to resolve user-name instead of SID to be able to lookup local 
passwd/group tables for UID/GID and return it from the script.

note: I also tried to set domain:
   wbinfo --domain SMBSETUP ...

Goal is to avoid of using the username map in case the thousands of 
users are needed to map.

tested by command:
wbinfo -i SMBSETUP\\User01

/var/samba/log/idmap_script:
SIDTOID S-1-5-21-2333814099-3920965580-3603487294-8647
resolved


/var/samba/log/log.winbindd-idmap:
[2024/03/25 10:19:11.783791,  3] 
../../lib/util/modules.c:167(load_module_absolute_path)
   load_module_absolute_path: Module 
'/usr/lib/samba/sparcv9/idmap/tdb2.so' loaded
[2024/03/25 10:19:11.784043,  1] 
../../source3/winbindd/idmap_tdb2.c:561(idmap_tdb2_db_init)
   using idmap script '/etc/samba/idmap_script'
failed to call wbcLookupSid: WBC_ERR_DOMAIN_NOT_FOUND
Could not lookup sid S-1-5-21-2333814099-3920965580-3603487294-8647

on command line (for reference):
wbinfo -s S-1-5-21-2333814099-3920965580-3603487294-8647
SMBSETUP\User01 1
...it works fine

Do you have an idea how to solve this issue?

Is there any better interface i.e. on python ABI?

Many thanks,
Jiri



More information about the samba-technical mailing list