mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
Add files for new LGPL libwbclient DSO implementing the Winbind client API
(based on the winbind_struct_protocol.h). The API in incomplete, but sufficient to merge. See wbclienbt.h for the i interface functions.
This commit is contained in:
parent
740a2b080d
commit
83d274b460
@ -63,6 +63,7 @@ KRB5LIBS=@KRB5_LIBS@
|
||||
LDAP_LIBS=@LDAP_LIBS@
|
||||
NSCD_LIBS=@NSCD_LIBS@
|
||||
UUID_LIBS=@UUID_LIBS@
|
||||
WINBIND_LIBS=@WINBIND_LIBS@
|
||||
DNSSD_LIBS=@DNSSD_LIBS@
|
||||
|
||||
INSTALLCMD=@INSTALL@
|
||||
@ -90,6 +91,7 @@ BINDIR = @bindir@
|
||||
SBINDIR = @sbindir@
|
||||
ROOTSBINDIR = @rootsbindir@
|
||||
LIBDIR = @libdir@
|
||||
INCLUDEDIR=@includedir@
|
||||
PAMMODULESDIR = @pammodulesdir@
|
||||
VFSLIBDIR = $(LIBDIR)/vfs
|
||||
PDBLIBDIR = $(LIBDIR)/pdb
|
||||
@ -141,6 +143,7 @@ PIDDIR = @piddir@
|
||||
LIBSMBCLIENT=bin/libsmbclient.a @LIBSMBCLIENT_SHARED@
|
||||
LIBSMBSHAREMODES=bin/libsmbsharemodes.a @LIBSMBSHAREMODES_SHARED@
|
||||
LIBADDNS=bin/libaddns.a @LIBADDNS_SHARED@
|
||||
LIBWBCLIENT=@LIBWBCLIENT_SHARED@
|
||||
LIBNETAPI=bin/libnetapi.a @LIBNETAPI_SHARED@
|
||||
|
||||
FLAGS1 = $(CFLAGS) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS)
|
||||
@ -199,7 +202,7 @@ EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ \
|
||||
bin/log2pcap@EXEEXT@ bin/sharesec@EXEEXT@ bin/ndrdump@EXEEXT@ \
|
||||
bin/vlp@EXEEXT@
|
||||
|
||||
SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@ @LIBNETAPI@
|
||||
SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@ @LIBNETAPI@ @LIBWBCLIENT@
|
||||
|
||||
PAM_MODULES = @PAM_MODULES@
|
||||
|
||||
@ -281,6 +284,7 @@ NSS_WRAPPER_OBJ = @NSS_WRAPPER_OBJS@
|
||||
|
||||
TALLOC_OBJ = lib/talloc/talloc.o
|
||||
|
||||
LIBSAMBAUTIL_OBJ = $(TALLOC_OBJ) $(LIBREPLACE_OBJ)
|
||||
|
||||
LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(NSS_WRAPPER_OBJ) $(TALLOC_OBJ) \
|
||||
lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \
|
||||
@ -302,7 +306,7 @@ LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
|
||||
lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
|
||||
lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
|
||||
lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o \
|
||||
nsswitch/wb_client.o $(WBCOMMON_OBJ) \
|
||||
$(WBCOMMON_OBJ) \
|
||||
lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
|
||||
lib/adt_tree.o lib/gencache.o $(TDB_OBJ) \
|
||||
lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \
|
||||
@ -331,6 +335,15 @@ LIBADDNS_OBJ0 = libaddns/dnsrecord.o libaddns/dnsutils.o libaddns/dnssock.o \
|
||||
libaddns/dnsgss.o libaddns/dnsmarshall.o
|
||||
LIBADDNS_OBJ = $(LIBADDNS_OBJ0) $(TALLOC_OBJ)
|
||||
|
||||
LIBWBCLIENT_OBJ = nsswitch/wb_common.o lib/talloc/talloc.o \
|
||||
nsswitch/libwbclient/wbclient.o \
|
||||
nsswitch/libwbclient/wbc_util.o \
|
||||
nsswitch/libwbclient/wbc_pwd.o \
|
||||
nsswitch/libwbclient/wbc_idmap.o \
|
||||
nsswitch/libwbclient/wbc_sid.o \
|
||||
nsswitch/libwbclient/wbc_pam.o
|
||||
|
||||
|
||||
LIBGPO_OBJ0 = libgpo/gpo_ldap.o libgpo/gpo_ini.o libgpo/gpo_util.o \
|
||||
libgpo/gpo_fetch.o libgpo/gpo_filesync.o libgpo/gpo_sec.o
|
||||
LIBGPO_OBJ = $(LIBGPO_OBJ0)
|
||||
@ -453,7 +466,7 @@ PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \
|
||||
passdb/util_unixsids.o passdb/lookup_sid.o \
|
||||
passdb/login_cache.o @PDB_STATIC@ \
|
||||
lib/account_pol.o lib/privileges.o lib/privileges_basic.o \
|
||||
lib/util_nscd.o
|
||||
lib/util_nscd.o lib/winbind_util.o
|
||||
|
||||
DEVEL_HELP_WEIRD_OBJ = modules/weird.o
|
||||
CP850_OBJ = modules/CP850.o
|
||||
@ -570,6 +583,7 @@ PRINTBASE_OBJ = printing/notify.o printing/printing_db.o
|
||||
PRINTBACKEND_OBJ = printing/printing.o printing/nt_printing.o $(PRINTBASE_OBJ)
|
||||
|
||||
SMBD_OBJ = $(SMBD_OBJ_BASE) $(SMBD_OBJ_MAIN)
|
||||
|
||||
NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \
|
||||
nmbd/nmbd_become_lmb.o nmbd/nmbd_browserdb.o \
|
||||
nmbd/nmbd_browsesync.o nmbd/nmbd_elections.o \
|
||||
@ -623,12 +637,13 @@ PASSWD_UTIL_OBJ = utils/passwd_util.o
|
||||
SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \
|
||||
$(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \
|
||||
$(GROUPDB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \
|
||||
$(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) $(LDB_OBJ)
|
||||
$(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) \
|
||||
$(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) $(LDB_OBJ)
|
||||
|
||||
PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) \
|
||||
$(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) \
|
||||
$(SECRETS_OBJ) $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) libsmb/asn1.o \
|
||||
$(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ)
|
||||
$(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ)
|
||||
|
||||
SMBGET_OBJ = utils/smbget.o $(POPT_LIB_OBJ) $(LIBSMBCLIENT_OBJ)
|
||||
|
||||
@ -649,7 +664,7 @@ RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
|
||||
$(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \
|
||||
$(READLINE_OBJ) $(GROUPDB_OBJ) $(KRBCLIENT_OBJ) \
|
||||
$(LIBADS_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \
|
||||
$(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(LDB_OBJ)
|
||||
$(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(LDB_OBJ)
|
||||
|
||||
PAM_WINBIND_OBJ = nsswitch/pam_winbind.o $(WBCOMMON_OBJ) \
|
||||
$(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) @BUILD_INIPARSER@
|
||||
@ -682,7 +697,7 @@ CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \
|
||||
$(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \
|
||||
$(READLINE_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \
|
||||
$(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \
|
||||
$(DISPLAY_SEC_OBJ)
|
||||
$(DISPLAY_SEC_OBJ)
|
||||
|
||||
UTIL_REG_OBJ = lib/util_reg.o
|
||||
UTIL_REG_API_OBJ = lib/util_reg_api.o
|
||||
@ -731,7 +746,7 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_domain.o utils/net_help.o \
|
||||
utils/netlookup.o utils/net_sam.o utils/net_rpc_shell.o \
|
||||
utils/net_util.o utils/net_rpc_sh_acct.o utils/net_rpc_audit.o \
|
||||
$(PASSWD_UTIL_OBJ) utils/net_dns.o utils/net_ads_gpo.o \
|
||||
utils/net_conf.o auth/token_util.o utils/net_dom.o
|
||||
utils/net_conf.o auth/token_util.o utils/net_dom.o nsswitch/wb_client.o
|
||||
|
||||
NET_OBJ = $(NET_OBJ1) $(PARAM_WITHOUT_REG_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
|
||||
$(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
|
||||
@ -796,9 +811,10 @@ LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \
|
||||
$(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ)
|
||||
|
||||
SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
|
||||
$(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
|
||||
$(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(SECRETS_OBJ) \
|
||||
$(POPT_LIB_OBJ) $(DCUTIL_OBJ) $(LIBADS_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ)
|
||||
$(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
|
||||
$(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
|
||||
$(SECRETS_OBJ) \
|
||||
$(POPT_LIB_OBJ) $(DCUTIL_OBJ) $(LIBADS_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ)
|
||||
|
||||
SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
|
||||
$(PARAM_OBJ) \
|
||||
@ -902,10 +918,11 @@ WINBINDD_OBJ = \
|
||||
$(SECRETS_OBJ) $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
|
||||
$(DCUTIL_OBJ) $(IDMAP_OBJ) $(NSS_INFO_OBJ) \
|
||||
$(AFS_OBJ) $(AFS_SETTOKEN_OBJ) \
|
||||
$(LIBADS_SERVER_OBJ) $(SERVER_MUTEX_OBJ) $(LDB_OBJ)
|
||||
$(LIBADS_SERVER_OBJ) $(SERVER_MUTEX_OBJ) $(LDB_OBJ)
|
||||
|
||||
WBINFO_OBJ = nsswitch/wbinfo.o $(LIBSAMBA_OBJ) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
|
||||
$(SECRETS_OBJ) $(POPT_LIB_OBJ) $(AFS_SETTOKEN_OBJ) $(RPC_PARSE_OBJ1) $(DOSERR_OBJ)
|
||||
$(SECRETS_OBJ) $(POPT_LIB_OBJ) $(AFS_SETTOKEN_OBJ) $(RPC_PARSE_OBJ1) \
|
||||
$(DOSERR_OBJ) lib/winbind_util.o
|
||||
|
||||
WINBIND_NSS_OBJ = $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) @WINBIND_NSS_EXTRA_OBJS@
|
||||
|
||||
@ -935,7 +952,7 @@ LDB_CMDLINE_OBJ = $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
|
||||
$(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ) \
|
||||
$(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(SERVER_MUTEX_OBJ) \
|
||||
$(AFS_OBJ) $(AFS_SETTOKEN_OBJ) $(REGFIO_OBJ) $(READLINE_OBJ) \
|
||||
$(LDB_OBJ) lib/ldb/tools/cmdline.o
|
||||
$(LDB_OBJ) lib/ldb/tools/cmdline.o
|
||||
|
||||
|
||||
LDBEDIT_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbedit.o
|
||||
@ -973,7 +990,7 @@ NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \
|
||||
libads/kerberos_verify.o $(SECRETS_OBJ) $(SERVER_MUTEX_OBJ) \
|
||||
libads/authdata.o $(RPC_PARSE_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
|
||||
$(SMBLDAP_OBJ) $(DOSERR_OBJ) rpc_parse/parse_net.o $(LIBNMB_OBJ) \
|
||||
$(LDB_OBJ) $(ERRORMAP_OBJ)
|
||||
$(LDB_OBJ) $(ERRORMAP_OBJ)
|
||||
|
||||
VLP_OBJ1 = ../testsuite/printing/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ)
|
||||
|
||||
@ -1152,37 +1169,41 @@ bin/.dummy:
|
||||
dir=bin $(MAKEDIR); fi
|
||||
@: >> $@ || : > $@ # what a fancy emoticon!
|
||||
|
||||
bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @BUILD_POPT@
|
||||
bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @LIBWBCLIENT_SHARED@ @BUILD_POPT@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) \
|
||||
$(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \
|
||||
$(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) \
|
||||
@POPTLIBS@ @SMBD_LIBS@
|
||||
@POPTLIBS@ @SMBD_LIBS@ @WINBIND_LIBS@
|
||||
|
||||
bin/nmbd@EXEEXT@: $(BINARY_PREREQS) $(NMBD_OBJ) @BUILD_POPT@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
|
||||
|
||||
bin/swat@EXEEXT@: $(BINARY_PREREQS) $(SWAT_OBJ) @BUILD_POPT@
|
||||
bin/swat@EXEEXT@: $(BINARY_PREREQS) $(SWAT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINT_LIBS) \
|
||||
$(AUTH_LIBS) $(LIBS) $(PASSDB_LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
|
||||
$(AUTH_LIBS) $(LIBS) $(PASSDB_LIBS) @POPTLIBS@ $(KRB5LIBS) \
|
||||
$(LDAP_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@
|
||||
bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(PASSDB_LIBS) $(RPCCLIENT_OBJ) \
|
||||
$(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \
|
||||
$(KRB5LIBS) $(LDAP_LIBS)
|
||||
$(KRB5LIBS) $(LDAP_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@
|
||||
bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) \
|
||||
$(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \
|
||||
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(DNSSD_LIBS)
|
||||
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(DNSSD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@
|
||||
bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @INIPARSERLIBS@
|
||||
@$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) \
|
||||
$(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @INIPARSERLIBS@ @WINBIND_LIBS@
|
||||
|
||||
bin/profiles@EXEEXT@: $(BINARY_PREREQS) $(PROFILES_OBJ) @BUILD_POPT@
|
||||
@echo Linking $@
|
||||
@ -1232,22 +1253,25 @@ bin/smbcontrol@EXEEXT@: $(BINARY_PREREQS) $(SMBCONTROL_OBJ) @BUILD_POPT@
|
||||
$(SMBCONTROL_OBJ) $(DYNEXP) $(LDFLAGS) \
|
||||
$(LIBS) $(LDAP_LIBS) @LIBUNWIND_PTRACE@ @POPTLIBS@
|
||||
|
||||
bin/smbtree@EXEEXT@: $(BINARY_PREREQS) $(SMBTREE_OBJ) @BUILD_POPT@
|
||||
bin/smbtree@EXEEXT@: $(BINARY_PREREQS) $(SMBTREE_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) \
|
||||
$(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/smbpasswd@EXEEXT@: $(BINARY_PREREQS) $(SMBPASSWD_OBJ) @BUILD_POPT@
|
||||
bin/smbpasswd@EXEEXT@: $(BINARY_PREREQS) $(SMBPASSWD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(PASSDB_LIBS) \
|
||||
$(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
|
||||
$(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/pdbedit@EXEEXT@: $(BINARY_PREREQS) $(PDBEDIT_OBJ) @BUILD_POPT@
|
||||
bin/pdbedit@EXEEXT@: $(BINARY_PREREQS) $(PDBEDIT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(PASSDB_LIBS) $(LDAP_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
|
||||
@POPTLIBS@ $(PASSDB_LIBS) $(LDAP_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/smbget@EXEEXT@: $(BINARY_PREREQS) $(SMBGET_OBJ) @BUILD_POPT@
|
||||
bin/smbget@EXEEXT@: $(BINARY_PREREQS) $(SMBGET_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/samtest@EXEEXT@: $(SAMTEST_OBJ) @BUILD_POPT@
|
||||
@echo Linking $@
|
||||
@ -1279,15 +1303,15 @@ bin/msgtest@EXEEXT@: $(BINARY_PREREQS) $(MSGTEST_OBJ) @BUILD_POPT@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(MSGTEST_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@
|
||||
|
||||
bin/smbcacls@EXEEXT@: $(BINARY_PREREQS) $(SMBCACLS_OBJ) @BUILD_POPT@
|
||||
bin/smbcacls@EXEEXT@: $(BINARY_PREREQS) $(SMBCACLS_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ \
|
||||
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
|
||||
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/smbcquotas@EXEEXT@: $(BINARY_PREREQS) $(SMBCQUOTAS_OBJ) @BUILD_POPT@
|
||||
bin/smbcquotas@EXEEXT@: $(BINARY_PREREQS) $(SMBCQUOTAS_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ \
|
||||
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
|
||||
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/eventlogadm@EXEEXT@: $(BINARY_PREREQS) $(EVTLOGADM_OBJ) @BUILD_POPT@
|
||||
@echo Linking $@
|
||||
@ -1338,25 +1362,44 @@ bin/smbfilter@EXEEXT@: $(BINARY_PREREQS) $(SMBFILTER_OBJ) @BUILD_POPT@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(SMBFILTER_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@
|
||||
|
||||
bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@
|
||||
bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBEDIT_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBEDIT_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
|
||||
$(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/ldbsearch: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@
|
||||
bin/ldbsearch: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBSEARCH_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBSEARCH_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
|
||||
$(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/ldbadd: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@
|
||||
bin/ldbadd: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBADD_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBADD_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
|
||||
$(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/ldbmodify: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@
|
||||
bin/ldbmodify: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBMODIFY_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBMODIFY_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
|
||||
$(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@
|
||||
bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBDEL_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS)
|
||||
@$(CC) $(FLAGS) -o $@ $(LDBDEL_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
|
||||
$(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ)
|
||||
@echo Linking shared library $@
|
||||
@$(SHLD_DSO) $(LIBWBCLIENT_OBJ) \
|
||||
@SONAMEFLAG@`basename $@`.$(SONAME_VER)
|
||||
|
||||
bin/libwbclient.a: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ)
|
||||
@echo Linking non-shared library $@
|
||||
@-$(AR) -rc $@ $(LIBWBCLIENT_OBJ)
|
||||
|
||||
bin/libaddns.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
|
||||
@echo Linking shared library $@
|
||||
@ -1414,6 +1457,7 @@ bin/libbigballofmud.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBBIGBALLOFMUD_OBJ)
|
||||
libsmbclient: $(LIBSMBCLIENT)
|
||||
libsmbsharemodes: $(LIBSMBSHAREMODES)
|
||||
libaddns: $(LIBADDNS)
|
||||
libwbclient: $(LIBWBCLIENT)
|
||||
libnetapi: $(LIBNETAPI)
|
||||
|
||||
# Linker command to link a RPC, VFS, AUTH, CHARSET or PASSDB module.
|
||||
@ -1480,10 +1524,11 @@ bin/librpc_echo.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_ECHO_OBJ)
|
||||
@echo "Linking $@"
|
||||
@$(SHLD_MODULE) $(RPC_ECHO_OBJ)
|
||||
|
||||
bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@
|
||||
bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo "Linking $@"
|
||||
@$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS)
|
||||
@POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
|
||||
@WINBIND_LIBS@
|
||||
|
||||
bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ)
|
||||
@echo "Linking $@"
|
||||
@ -1704,16 +1749,17 @@ bin/fileid.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_FILEID_OBJ)
|
||||
## None here right now
|
||||
#########################################################
|
||||
|
||||
bin/wbinfo@EXEEXT@: $(BINARY_PREREQS) $(WBINFO_OBJ) @BUILD_POPT@
|
||||
bin/wbinfo@EXEEXT@: $(BINARY_PREREQS) $(WBINFO_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(WBINFO_OBJ) $(DYNEXP) $(LIBS) $(LDAP_LIBS) @POPTLIBS@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(WBINFO_OBJ) $(DYNEXP) $(LIBS) \
|
||||
$(LDAP_LIBS) @POPTLIBS@ @WINBIND_LIBS@
|
||||
|
||||
bin/ntlm_auth@EXEEXT@: $(BINARY_PREREQS) $(NTLM_AUTH_OBJ) $(PARAM_OBJ) \
|
||||
$(LIB_NONSMBD_OBJ) @BUILD_POPT@
|
||||
$(LIB_NONSMBD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(DYNEXP) $(NTLM_AUTH_OBJ) \
|
||||
$(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(LIBS) \
|
||||
@POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
|
||||
@POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@
|
||||
|
||||
bin/pam_smbpass.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_SMBPASS_OBJ)
|
||||
@echo "Linking shared library $@"
|
||||
@ -1751,8 +1797,10 @@ bin/timelimit@EXEEXT@: script/tests/timelimit.o
|
||||
@echo Linking $@
|
||||
@$(CC) $(FLAGS) -o $@ $(DYNEXP) script/tests/timelimit.o
|
||||
|
||||
install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ @INSTALL_LIBSMBCLIENT@ @INSTALL_PAM_MODULES@ @INSTALL_LIBSMBSHAREMODES@ @INSTALL_LIBNETAPI@
|
||||
|
||||
install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman \
|
||||
installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ \
|
||||
@INSTALL_LIBSMBCLIENT@ @INSTALL_PAM_MODULES@ \
|
||||
@INSTALL_LIBSMBSHAREMODES@ @INSTALL_LIBWBCLIENT@ @INSTALL_LIBNETAPI@
|
||||
|
||||
install-everything: install installmodules
|
||||
|
||||
@ -1830,6 +1878,11 @@ installlibaddns: installdirs libaddns
|
||||
-$(INSTALLLIBCMD_SH) bin/libaddns.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
|
||||
-$(INSTALLLIBCMD_A) bin/libaddns.a $(DESTDIR)$(LIBDIR)
|
||||
|
||||
installlibwbclient: installdirs libwbclient
|
||||
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) $(INCLUDEDIR)/samba
|
||||
-$(INSTALLLIBCMD_SH) bin/libwbclient.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
|
||||
-$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/nsswitch/libwbclient/wbclient.h $(DESTDIR)${prefix}/include/samba
|
||||
|
||||
installlibnetapi: installdirs libnetapi
|
||||
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR)
|
||||
-$(INSTALLLIBCMD_SH) bin/libnetapi.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
|
||||
|
@ -318,6 +318,15 @@ AC_SUBST(INSTALL_LIBADDNS)
|
||||
AC_SUBST(UNINSTALL_LIBADDNS)
|
||||
AC_SUBST(LIBADDNS_SHARED)
|
||||
AC_SUBST(LIBADDNS)
|
||||
|
||||
AC_SUBST(INSTALL_LIBWBCLIENT)
|
||||
AC_SUBST(UNINSTALL_LIBWBCLIENT)
|
||||
AC_SUBST(LIBWBCLIENT_SHARED)
|
||||
AC_SUBST(LIBWBCLIENT)
|
||||
AC_SUBST(WINBIND_LIBS)
|
||||
|
||||
AC_SUBST(LIBSAMBAUTIL_SHARED)
|
||||
|
||||
AC_SUBST(INSTALL_LIBSMBCLIENT)
|
||||
AC_SUBST(UNINSTALL_LIBSMBCLIENT)
|
||||
AC_SUBST(LIBSMBCLIENT_SHARED)
|
||||
@ -5143,11 +5152,13 @@ AC_ARG_WITH(libaddns,
|
||||
INSTALL_LIBADDNS=installlibaddns
|
||||
UNINSTALL_LIBADDNS=uninstalllibaddns
|
||||
;;
|
||||
esac ]
|
||||
esac ],
|
||||
[AC_MSG_RESULT(no)]
|
||||
)
|
||||
|
||||
#################################################
|
||||
# should we build libsmbclient?
|
||||
|
||||
INSTALL_LIBSMBCLIENT=
|
||||
UNINSTALL_LIBSMBCLIENT=
|
||||
LIBSMBCLIENT_SHARED=
|
||||
@ -5234,6 +5245,7 @@ AC_ARG_WITH(libsmbsharemodes,
|
||||
INSTALL_LIBSMBSHAREMODES=installlibsmbsharemodes
|
||||
)
|
||||
|
||||
|
||||
#################################################
|
||||
# these tests are taken from the GNU fileutils package
|
||||
AC_CHECKING(how to get filesystem space usage)
|
||||
@ -6133,6 +6145,14 @@ fi
|
||||
|
||||
if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes"; then
|
||||
NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}"
|
||||
## Only worry about libwbclient if we have shared library support
|
||||
## and winbindd
|
||||
LIBWBCLIENT_SHARED=bin/libwbclient.$SHLIBEXT
|
||||
LIBWBCLIENT=libwbclient
|
||||
INSTALL_LIBWBCLIENT=installlibwbclient
|
||||
UNINSTALL_LIBWBCLIENT=uninstalllibwbclient
|
||||
WINBIND_LIBS="-lwbclient"
|
||||
LDFLAGS="$LDFLAGS -L./bin"
|
||||
fi
|
||||
|
||||
if test x"$HAVE_WINBIND" = x"yes"; then
|
||||
|
4
source/exports/libwbclient.syms
Normal file
4
source/exports/libwbclient.syms
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
global: wbc*;
|
||||
local: *;
|
||||
};
|
@ -6,4 +6,5 @@ bin/libsmbclient.@SHLIBEXT@:0:1
|
||||
bin/libsmbsharemodes.@SHLIBEXT@:0:2
|
||||
bin/libaddns.@SHLIBEXT@:0:1
|
||||
bin/libmsrpc.@SHLIBEXT@:0:1
|
||||
bin/libwbclient.@SHLIBEXT@:0:1
|
||||
|
||||
|
1297
source/nsswitch/libwbclient/Doxyfile
Normal file
1297
source/nsswitch/libwbclient/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
46
source/nsswitch/libwbclient/libwbclient.h
Normal file
46
source/nsswitch/libwbclient/libwbclient.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _LIBWBCLIENT_H
|
||||
#define _LIBWBCLIENT_H
|
||||
|
||||
/* Super header including necessary public and private header files
|
||||
for building the wbclient library. __DO NOT__ define anything
|
||||
in this file. Only include other headers. */
|
||||
|
||||
/* Winbind headers */
|
||||
|
||||
#include "nsswitch/winbind_nss_config.h"
|
||||
#include "nsswitch/winbind_struct_protocol.h"
|
||||
|
||||
#include <talloc.h>
|
||||
|
||||
/* Public headers */
|
||||
|
||||
#include "wbclient.h"
|
||||
|
||||
/* Private headers */
|
||||
|
||||
#include "wbc_err_internal.h"
|
||||
#include "wbclient_internal.h"
|
||||
|
||||
|
||||
#endif /* _LIBWBCLIENT_H */
|
51
source/nsswitch/libwbclient/wbc_err.h
Normal file
51
source/nsswitch/libwbclient/wbc_err.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _WBC_ERR_H
|
||||
#define _WBC_ERR_H
|
||||
|
||||
|
||||
/* Define error types */
|
||||
|
||||
/**
|
||||
* @brief Status codes returned from wbc functions
|
||||
**/
|
||||
|
||||
enum _wbcErrType {
|
||||
WBC_ERR_SUCCESS = 0, /**< Successful completion **/
|
||||
WBC_ERR_NOT_IMPLEMENTED,/**< Function not implemented **/
|
||||
WBC_ERR_UNKNOWN_FAILURE,/**< General failure **/
|
||||
WBC_ERR_NO_MEMORY, /**< Memory allocation error **/
|
||||
WBC_ERR_INVALID_SID, /**< Invalid SID format **/
|
||||
WBC_ERR_INVALID_PARAM, /**< An Invalid parameter was supplied **/
|
||||
WBC_ERR_WINBIND_NOT_AVAILABLE, /**< Winbind daemon is not available **/
|
||||
WBC_ERR_DOMAIN_NOT_FOUND, /**< Domain is not trusted or cannot be found **/
|
||||
WBC_INVALID_RESPONSE, /**< Winbind returned an invalid response **/
|
||||
WBC_ERR_NSS_ERROR /**< NSS_STATUS error **/
|
||||
};
|
||||
|
||||
typedef enum _wbcErrType wbcErr;
|
||||
|
||||
#define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS)
|
||||
|
||||
char *wbcErrorString(wbcErr error);
|
||||
|
||||
#endif /* _WBC_ERR_H */
|
44
source/nsswitch/libwbclient/wbc_err_internal.h
Normal file
44
source/nsswitch/libwbclient/wbc_err_internal.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _WBC_ERR_INTERNAL_H
|
||||
#define _WBC_ERR_INTERNAL_H
|
||||
|
||||
/* Private macros */
|
||||
|
||||
#define BAIL_ON_WBC_ERROR(x) \
|
||||
do { \
|
||||
if ((x) != WBC_ERR_SUCCESS) \
|
||||
goto done; \
|
||||
} while(0);
|
||||
|
||||
#define BAIL_ON_PTR_ERROR(x, status) \
|
||||
do { \
|
||||
if ((x) == NULL) { \
|
||||
status = WBC_ERR_NO_MEMORY; \
|
||||
goto done; \
|
||||
} else { \
|
||||
status = WBC_ERR_SUCCESS; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
|
||||
#endif /* _WBC_ERR_INTERNAL_H */
|
272
source/nsswitch/libwbclient/wbc_idmap.c
Normal file
272
source/nsswitch/libwbclient/wbc_idmap.c
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Required Headers */
|
||||
|
||||
#include "libwbclient.h"
|
||||
|
||||
/** @brief Convert a Windows SID to a Unix uid
|
||||
*
|
||||
* @param *sid Pointer to the domain SID to be resolved
|
||||
* @param *puid Pointer to the resolved uid_t value
|
||||
*
|
||||
* @return #wbcErr
|
||||
*
|
||||
**/
|
||||
|
||||
wbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
char *sid_string = NULL;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
if (!sid || !puid) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
wbc_status = wbcSidToString(sid, &sid_string);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
|
||||
wbcFreeMemory(sid_string);
|
||||
|
||||
/* Make request */
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_SID_TO_UID,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
*puid = response.data.uid;
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Convert a Unix uid to a Windows SID
|
||||
*
|
||||
* @param uid Unix uid to be resolved
|
||||
* @param *sid Pointer to the resolved domain SID
|
||||
*
|
||||
* @return #wbcErr
|
||||
*
|
||||
**/
|
||||
|
||||
wbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
|
||||
if (!sid) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
request.data.uid = uid;
|
||||
|
||||
/* Make request */
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_UID_TO_SID,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
wbc_status = wbcStringToSid(response.data.sid.sid, sid);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Convert a Windows SID to a Unix gid
|
||||
*
|
||||
* @param *sid Pointer to the domain SID to be resolved
|
||||
* @param *pgid Pointer to the resolved gid_t value
|
||||
*
|
||||
* @return #wbcErr
|
||||
*
|
||||
**/
|
||||
|
||||
wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
char *sid_string = NULL;
|
||||
|
||||
if (!sid || !pgid) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
wbc_status = wbcSidToString(sid, &sid_string);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
|
||||
wbcFreeMemory(sid_string);
|
||||
|
||||
/* Make request */
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_SID_TO_GID,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
*pgid = response.data.gid;
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Convert a Unix uid to a Windows SID
|
||||
*
|
||||
* @param gid Unix gid to be resolved
|
||||
* @param *sid Pointer to the resolved domain SID
|
||||
*
|
||||
* @return #wbcErr
|
||||
*
|
||||
**/
|
||||
|
||||
wbcErr wbcGidToSid(gid_t gid, struct wbcDomainSid *sid)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
if (!sid) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
request.data.gid = gid;
|
||||
|
||||
/* Make request */
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_GID_TO_SID,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
wbc_status = wbcStringToSid(response.data.sid.sid, sid);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Obtain a new uid from Winbind
|
||||
*
|
||||
* @param *puid *pointer to the allocated uid
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcAllocateUid(uid_t *puid)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
NSS_STATUS result;
|
||||
|
||||
if (!puid)
|
||||
return WBC_ERR_INVALID_PARAM;
|
||||
|
||||
/* Initialise request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
/* Make request */
|
||||
|
||||
result = wbcRequestResponse(WINBINDD_ALLOCATE_UID,
|
||||
&request, &response);
|
||||
|
||||
if (result != NSS_STATUS_SUCCESS)
|
||||
return WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
/* Copy out result */
|
||||
*puid = response.data.uid;
|
||||
|
||||
return WBC_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/** @brief Obtain a new gid from Winbind
|
||||
*
|
||||
* @param *pgid Pointer to the allocated gid
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcAllocateGid(uid_t *pgid)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
NSS_STATUS result;
|
||||
|
||||
if (!pgid)
|
||||
return WBC_ERR_INVALID_PARAM;
|
||||
|
||||
/* Initialise request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
/* Make request */
|
||||
|
||||
result = wbcRequestResponse(WINBINDD_ALLOCATE_GID,
|
||||
&request, &response);
|
||||
|
||||
if (result != NSS_STATUS_SUCCESS)
|
||||
return WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
/* Copy out result */
|
||||
*pgid = response.data.gid;
|
||||
|
||||
return WBC_ERR_SUCCESS;
|
||||
}
|
||||
|
65
source/nsswitch/libwbclient/wbc_pam.c
Normal file
65
source/nsswitch/libwbclient/wbc_pam.c
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Required Headers */
|
||||
|
||||
#include "libwbclient.h"
|
||||
|
||||
/** @brief Authenticate a username/password pair
|
||||
*
|
||||
* @param username Name of user to authenticate
|
||||
* @param password Clear text password os user
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcAuthenticateUser(const char *username,
|
||||
const char *password)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
|
||||
if (!username) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
/* dst is already null terminated from the memset above */
|
||||
|
||||
strncpy(request.data.auth.user, username,
|
||||
sizeof(request.data.auth.user)-1);
|
||||
strncpy(request.data.auth.pass, password,
|
||||
sizeof(request.data.auth.user)-1);
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_PAM_AUTH,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
374
source/nsswitch/libwbclient/wbc_pwd.c
Normal file
374
source/nsswitch/libwbclient/wbc_pwd.c
Normal file
@ -0,0 +1,374 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Required Headers */
|
||||
|
||||
#include "libwbclient.h"
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
|
||||
static struct passwd *copy_passwd_entry(struct winbindd_pw *p)
|
||||
{
|
||||
struct passwd *pwd = NULL;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
pwd = talloc(NULL, struct passwd);
|
||||
BAIL_ON_PTR_ERROR(pwd, wbc_status);
|
||||
|
||||
pwd->pw_name = talloc_strdup(pwd,p->pw_name);
|
||||
BAIL_ON_PTR_ERROR(pwd->pw_name, wbc_status);
|
||||
|
||||
pwd->pw_passwd = talloc_strdup(pwd, p->pw_passwd);
|
||||
BAIL_ON_PTR_ERROR(pwd->pw_passwd, wbc_status);
|
||||
|
||||
pwd->pw_gecos = talloc_strdup(pwd, p->pw_gecos);
|
||||
BAIL_ON_PTR_ERROR(pwd->pw_gecos, wbc_status);
|
||||
|
||||
pwd->pw_shell = talloc_strdup(pwd, p->pw_shell);
|
||||
BAIL_ON_PTR_ERROR(pwd->pw_shell, wbc_status);
|
||||
|
||||
pwd->pw_dir = talloc_strdup(pwd, p->pw_dir);
|
||||
BAIL_ON_PTR_ERROR(pwd->pw_dir, wbc_status);
|
||||
|
||||
pwd->pw_uid = p->pw_uid;
|
||||
pwd->pw_gid = p->pw_gid;
|
||||
|
||||
done:
|
||||
if (!WBC_ERROR_IS_OK(wbc_status)) {
|
||||
talloc_free(pwd);
|
||||
pwd = NULL;
|
||||
}
|
||||
|
||||
return pwd;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
|
||||
static struct group *copy_group_entry(struct winbindd_gr *g,
|
||||
char *mem_buf)
|
||||
{
|
||||
struct group *grp = NULL;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
int i;
|
||||
char *mem_p, *mem_q;
|
||||
|
||||
grp = talloc(NULL, struct group);
|
||||
BAIL_ON_PTR_ERROR(grp, wbc_status);
|
||||
|
||||
grp->gr_name = talloc_strdup(grp, g->gr_name);
|
||||
BAIL_ON_PTR_ERROR(grp->gr_name, wbc_status);
|
||||
|
||||
grp->gr_passwd = talloc_strdup(grp, g->gr_passwd);
|
||||
BAIL_ON_PTR_ERROR(grp->gr_passwd, wbc_status);
|
||||
|
||||
grp->gr_gid = g->gr_gid;
|
||||
|
||||
grp->gr_mem = talloc_array(grp, char*, g->num_gr_mem+1);
|
||||
|
||||
mem_p = mem_q = mem_buf;
|
||||
for (i=0; i<g->num_gr_mem && mem_p; i++) {
|
||||
if ((mem_q = strchr(mem_p, ',')) != NULL) {
|
||||
*mem_q = '\0';
|
||||
}
|
||||
|
||||
grp->gr_mem[i] = talloc_strdup(grp, mem_p);
|
||||
BAIL_ON_PTR_ERROR(grp->gr_mem[i], wbc_status);
|
||||
|
||||
*mem_q = ',';
|
||||
mem_p++;
|
||||
mem_p = mem_q;
|
||||
}
|
||||
grp->gr_mem[g->num_gr_mem] = NULL;
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
if (!WBC_ERROR_IS_OK(wbc_status)) {
|
||||
talloc_free(grp);
|
||||
grp = NULL;
|
||||
}
|
||||
|
||||
return grp;
|
||||
}
|
||||
|
||||
/** @brief Fill in a struct passwd* for a domain user based
|
||||
* on username
|
||||
*
|
||||
* @param *name Username to lookup
|
||||
* @param **pwd Pointer to resulting struct passwd* from the query.
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcGetpwnam(const char *name, struct passwd **pwd)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
|
||||
if (!name || !pwd) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
/* dst is already null terminated from the memset above */
|
||||
|
||||
strncpy(request.data.username, name, sizeof(request.data.username)-1);
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_GETPWNAM,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
*pwd = copy_passwd_entry(&response.data.pw);
|
||||
BAIL_ON_PTR_ERROR(*pwd, wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Fill in a struct passwd* for a domain user based
|
||||
* on uid
|
||||
*
|
||||
* @param uid Uid to lookup
|
||||
* @param **pwd Pointer to resulting struct passwd* from the query.
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
|
||||
if (!pwd) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
request.data.uid = uid;
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_GETPWUID,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
*pwd = copy_passwd_entry(&response.data.pw);
|
||||
BAIL_ON_PTR_ERROR(*pwd, wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Fill in a struct passwd* for a domain user based
|
||||
* on username
|
||||
*
|
||||
* @param *name Username to lookup
|
||||
* @param **grp Pointer to resulting struct group* from the query.
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcGetgrnam(const char *name, struct group **grp)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
|
||||
if (!name || !grp) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
/* dst is already null terminated from the memset above */
|
||||
|
||||
strncpy(request.data.groupname, name, sizeof(request.data.groupname)-1);
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_GETGRNAM,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
*grp = copy_group_entry(&response.data.gr, response.extra_data.data);
|
||||
BAIL_ON_PTR_ERROR(*grp, wbc_status);
|
||||
|
||||
done:
|
||||
if (response.extra_data.data)
|
||||
free(response.extra_data.data);
|
||||
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Fill in a struct passwd* for a domain user based
|
||||
* on uid
|
||||
*
|
||||
* @param gid Uid to lookup
|
||||
* @param **grp Pointer to resulting struct group* from the query.
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
|
||||
if (!grp) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
request.data.gid = gid;
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_GETGRGID,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
*grp = copy_group_entry(&response.data.gr, response.extra_data.data);
|
||||
BAIL_ON_PTR_ERROR(*grp, wbc_status);
|
||||
|
||||
done:
|
||||
if (response.extra_data.data)
|
||||
free(response.extra_data.data);
|
||||
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Reset the passwd iterator
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcSetpwent(void)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_SETPWENT,
|
||||
NULL, NULL);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Close the passwd iterator
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcEndpwent(void)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_ENDPWENT,
|
||||
NULL, NULL);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Return the next struct passwd* entry from the pwent iterator
|
||||
*
|
||||
* @param **pwd Pointer to resulting struct group* from the query.
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcGetpwent(struct passwd **pwd)
|
||||
{
|
||||
return WBC_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/** @brief Reset the group iterator
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcSetgrent(void)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_SETGRENT,
|
||||
NULL, NULL);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Close the group iterator
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcEndgrent(void)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_ENDGRENT,
|
||||
NULL, NULL);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Return the next struct passwd* entry from the pwent iterator
|
||||
*
|
||||
* @param **grp Pointer to resulting struct group* from the query.
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcGetgrent(struct group **grp)
|
||||
{
|
||||
return WBC_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
420
source/nsswitch/libwbclient/wbc_sid.c
Normal file
420
source/nsswitch/libwbclient/wbc_sid.c
Normal file
@ -0,0 +1,420 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Required Headers */
|
||||
|
||||
#include "libwbclient.h"
|
||||
|
||||
|
||||
/** @brief Convert a binary SID to a character string
|
||||
*
|
||||
* @param sid Binary Security Identifier
|
||||
* @param **sid_string Resulting character string
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcSidToString(const struct wbcDomainSid *sid,
|
||||
char **sid_string)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
uint32_t id_auth;
|
||||
int i;
|
||||
char *tmp = NULL;
|
||||
TALLOC_CTX *ctx = NULL;
|
||||
|
||||
if (!sid) {
|
||||
wbc_status = WBC_ERR_INVALID_SID;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
ctx = talloc_init("wbcSidToString");
|
||||
BAIL_ON_PTR_ERROR(ctx, wbc_status);
|
||||
|
||||
id_auth = sid->id_auth[5] +
|
||||
(sid->id_auth[4] << 8) +
|
||||
(sid->id_auth[3] << 16) +
|
||||
(sid->id_auth[2] << 24);
|
||||
|
||||
tmp = talloc_asprintf(ctx, "S-%d-%d", sid->sid_rev_num, id_auth);
|
||||
BAIL_ON_PTR_ERROR(tmp, wbc_status);
|
||||
|
||||
for (i=0; i<sid->num_auths; i++) {
|
||||
char *tmp2 =
|
||||
tmp2 = talloc_asprintf_append(tmp, "-%u", sid->sub_auths[i]);
|
||||
BAIL_ON_PTR_ERROR(tmp2, wbc_status);
|
||||
|
||||
tmp = tmp2;
|
||||
}
|
||||
|
||||
*sid_string=talloc_strdup(NULL, tmp);
|
||||
BAIL_ON_PTR_ERROR((*sid_string), wbc_status);
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
talloc_free(ctx);
|
||||
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Convert a character string to a binary SID
|
||||
*
|
||||
* @param *str Character string in the form of S-...
|
||||
* @param sid Resulting binary SID
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcStringToSid(const char *str,
|
||||
struct wbcDomainSid *sid)
|
||||
{
|
||||
const char *p;
|
||||
char *q;
|
||||
uint32_t x;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
if (!sid) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Sanity check for either "S-" or "s-" */
|
||||
|
||||
if (!str
|
||||
|| (str[0]!='S' && str[0]!='s')
|
||||
|| (str[1]!='-')
|
||||
|| (strlen(str)<2))
|
||||
{
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Get the SID revision number */
|
||||
|
||||
p = str+2;
|
||||
x = (uint32_t)strtol(p, &q, 10);
|
||||
if (x==0 || !q || *q!='-') {
|
||||
wbc_status = WBC_ERR_INVALID_SID;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
sid->sid_rev_num = (uint8_t)x;
|
||||
|
||||
/* Next the Identifier Authority. This is stored in big-endian
|
||||
in a 6 byte array. */
|
||||
|
||||
p = q+1;
|
||||
x = (uint32_t)strtol(p, &q, 10);
|
||||
if (x==0 || !q || *q!='-') {
|
||||
wbc_status = WBC_ERR_INVALID_SID;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
sid->id_auth[5] = (x & 0x000000ff);
|
||||
sid->id_auth[4] = (x & 0x0000ff00) >> 8;
|
||||
sid->id_auth[3] = (x & 0x00ff0000) >> 16;
|
||||
sid->id_auth[2] = (x & 0xff000000) >> 24;
|
||||
sid->id_auth[1] = 0;
|
||||
sid->id_auth[0] = 0;
|
||||
|
||||
/* now read the the subauthorities */
|
||||
|
||||
p = q +1;
|
||||
sid->num_auths = 0;
|
||||
while (sid->num_auths < MAXSUBAUTHS) {
|
||||
if ((x=(uint32_t)strtoul(p, &q, 10)) == 0)
|
||||
break;
|
||||
sid->sub_auths[sid->num_auths++] = x;
|
||||
|
||||
if (q && ((*q!='-') || (*q=='\0')))
|
||||
break;
|
||||
p = q + 1;
|
||||
}
|
||||
|
||||
/* IF we ended early, then the SID could not be converted */
|
||||
|
||||
if (q && *q!='\0') {
|
||||
wbc_status = WBC_ERR_INVALID_SID;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
|
||||
}
|
||||
|
||||
/** @brief Convert a domain and name to SID
|
||||
*
|
||||
* @param domain Domain name (possibly "")
|
||||
* @param name User or group name
|
||||
* @param *sid Pointer to the resolved domain SID
|
||||
* @param *name_type Pointet to the SID type
|
||||
*
|
||||
* @return #wbcErr
|
||||
*
|
||||
**/
|
||||
|
||||
wbcErr wbcLookupName(const char *domain,
|
||||
const char *name,
|
||||
struct wbcDomainSid *sid,
|
||||
enum wbcSidType *name_type)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
if (!sid || !name_type) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
/* dst is already null terminated from the memset above */
|
||||
|
||||
strncpy(request.data.name.dom_name, domain,
|
||||
sizeof(request.data.name.dom_name)-1);
|
||||
strncpy(request.data.name.name, name,
|
||||
sizeof(request.data.name.name)-1);
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_LOOKUPNAME,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
wbc_status = wbcStringToSid(response.data.sid.sid, sid);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
*name_type = (enum wbcSidType)response.data.sid.type;
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Convert a SID to a domain and name
|
||||
*
|
||||
* @param *sid Pointer to the domain SID to be resolved
|
||||
* @param domain Resolved Domain name (possibly "")
|
||||
* @param name Resolved User or group name
|
||||
* @param *name_type Pointet to the resolved SID type
|
||||
*
|
||||
* @return #wbcErr
|
||||
*
|
||||
**/
|
||||
|
||||
wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
|
||||
char **domain,
|
||||
char **name,
|
||||
enum wbcSidType *name_type)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
char *sid_string = NULL;
|
||||
|
||||
if (!sid) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
/* dst is already null terminated from the memset above */
|
||||
|
||||
wbc_status = wbcSidToString(sid, &sid_string);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
|
||||
wbcFreeMemory(sid_string);
|
||||
|
||||
/* Make request */
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_LOOKUPSID,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
/* Copy out result */
|
||||
|
||||
if (domain != NULL) {
|
||||
*domain = strdup(response.data.name.dom_name);
|
||||
BAIL_ON_PTR_ERROR((*domain), wbc_status);
|
||||
}
|
||||
|
||||
if (name != NULL) {
|
||||
*name = strdup(response.data.name.name);
|
||||
BAIL_ON_PTR_ERROR((*name), wbc_status);
|
||||
}
|
||||
|
||||
if (name_type) {
|
||||
*name_type = (enum wbcSidType)response.data.name.type;
|
||||
}
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
if (!WBC_ERROR_IS_OK(wbc_status)) {
|
||||
if (*domain)
|
||||
free(*domain);
|
||||
if (*name)
|
||||
free(*name);
|
||||
}
|
||||
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Translate a collection of RIDs within a domain to names
|
||||
*
|
||||
**/
|
||||
|
||||
wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
|
||||
int num_rids,
|
||||
uint32_t *rids,
|
||||
const char **domain_name,
|
||||
const char ***names,
|
||||
enum wbcSidType **types)
|
||||
{
|
||||
size_t i, len, ridbuf_size;
|
||||
char *ridlist;
|
||||
char *p;
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
char *sid_string = NULL;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
|
||||
if (!dom_sid || (num_rids == 0)) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialise request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
wbc_status = wbcSidToString(dom_sid, &sid_string);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1);
|
||||
wbcFreeMemory(sid_string);
|
||||
|
||||
/* Even if all the Rids were of maximum 32bit values,
|
||||
we would only have 11 bytes per rid in the final array
|
||||
("4294967296" + \n). Add one more byte for the
|
||||
terminating '\0' */
|
||||
|
||||
ridbuf_size = (sizeof(char)*11) * num_rids + 1;
|
||||
|
||||
ridlist = malloc(ridbuf_size);
|
||||
BAIL_ON_PTR_ERROR(ridlist, wbc_status);
|
||||
|
||||
memset(ridlist, 0x0, ridbuf_size);
|
||||
|
||||
len = 0;
|
||||
for (i=0; i<num_rids && (len-1)>0; i++) {
|
||||
char ridstr[12];
|
||||
|
||||
len = strlen(ridlist);
|
||||
p = ridlist + len;
|
||||
|
||||
snprintf( ridstr, sizeof(ridstr)-1, "%u\n", rids[i]);
|
||||
strncat(p, ridstr, ridbuf_size-len-1);
|
||||
}
|
||||
|
||||
request.extra_data.data = ridlist;
|
||||
request.extra_len = strlen(ridlist)+1;
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_LOOKUPRIDS,
|
||||
&request,
|
||||
&response);
|
||||
free(ridlist);
|
||||
|
||||
*domain_name = strdup(response.data.domain_name);
|
||||
BAIL_ON_PTR_ERROR((*domain_name), wbc_status);
|
||||
|
||||
*names = (const char**)malloc(sizeof(char*) * num_rids);
|
||||
BAIL_ON_PTR_ERROR((*names), wbc_status);
|
||||
|
||||
*types = (enum wbcSidType*)malloc(sizeof(enum wbcSidType) * num_rids);
|
||||
BAIL_ON_PTR_ERROR((*types), wbc_status);
|
||||
|
||||
p = (char *)response.extra_data.data;
|
||||
|
||||
for (i=0; i<num_rids; i++) {
|
||||
char *q;
|
||||
|
||||
if (*p == '\0') {
|
||||
wbc_status = WBC_INVALID_RESPONSE;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
(*types)[i] = (enum wbcSidType)strtoul(p, &q, 10);
|
||||
|
||||
if (*q != ' ') {
|
||||
wbc_status = WBC_INVALID_RESPONSE;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
p = q+1;
|
||||
|
||||
if ((q = strchr(p, '\n')) == NULL) {
|
||||
wbc_status = WBC_INVALID_RESPONSE;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
*q = '\0';
|
||||
|
||||
(*names)[i] = strdup(p);
|
||||
|
||||
p = q+1;
|
||||
}
|
||||
|
||||
if (*p != '\0') {
|
||||
wbc_status = WBC_INVALID_RESPONSE;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
free(response.extra_data.data);
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
if (!WBC_ERROR_IS_OK(wbc_status)) {
|
||||
if (*domain_name)
|
||||
free(*domain_name);
|
||||
if (*names)
|
||||
free(*names);
|
||||
if (*types)
|
||||
free(*types);
|
||||
}
|
||||
|
||||
return wbc_status;
|
||||
}
|
110
source/nsswitch/libwbclient/wbc_util.c
Normal file
110
source/nsswitch/libwbclient/wbc_util.c
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Required Headers */
|
||||
|
||||
#include "libwbclient.h"
|
||||
|
||||
|
||||
|
||||
/** @brief Ping winbindd to see if the daemon is running
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
wbcErr wbcPing(void)
|
||||
{
|
||||
return wbcRequestResponse(WINBINDD_PING, NULL, NULL);
|
||||
}
|
||||
|
||||
/** @brief Lookup the current status of a trusted domain
|
||||
*
|
||||
* @param domain Domain to query
|
||||
* @param *info Pointer to returned domain_info struct
|
||||
*
|
||||
* @return #wbcErr
|
||||
*
|
||||
* The char* members of the struct wbcDomainInfo* are malloc()'d
|
||||
* and it the the responsibility of the caller to free the members
|
||||
* before discarding the struct.
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
struct wbcDomainInfo *info = NULL;
|
||||
|
||||
if (!domain || !dinfo) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
/* Initialize request */
|
||||
|
||||
ZERO_STRUCT(request);
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
strncpy(request.domain_name, domain,
|
||||
sizeof(request.domain_name)-1);
|
||||
|
||||
wbc_status = wbcRequestResponse(WINBINDD_DOMAIN_INFO,
|
||||
&request,
|
||||
&response);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
info = talloc(NULL, struct wbcDomainInfo);
|
||||
BAIL_ON_PTR_ERROR(info, wbc_status);
|
||||
|
||||
info->short_name = talloc_strdup(info,
|
||||
response.data.domain_info.name);
|
||||
BAIL_ON_PTR_ERROR(info->short_name, wbc_status);
|
||||
|
||||
info->dns_name = talloc_strdup(info,
|
||||
response.data.domain_info.alt_name);
|
||||
BAIL_ON_PTR_ERROR(info->dns_name, wbc_status);
|
||||
|
||||
wbc_status = wbcStringToSid(response.data.domain_info.sid,
|
||||
&info->sid);
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
|
||||
if (response.data.domain_info.native_mode)
|
||||
info->flags |= WBC_DOMINFO_NATIVE;
|
||||
if (response.data.domain_info.active_directory)
|
||||
info->flags |= WBC_DOMINFO_AD;
|
||||
if (response.data.domain_info.primary)
|
||||
info->flags |= WBC_DOMINFO_PRIMARY;
|
||||
|
||||
*dinfo = info;
|
||||
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
|
||||
done:
|
||||
if (!WBC_ERROR_IS_OK(wbc_status)) {
|
||||
talloc_free(info);
|
||||
}
|
||||
|
||||
return wbc_status;
|
||||
}
|
105
source/nsswitch/libwbclient/wbclient.c
Normal file
105
source/nsswitch/libwbclient/wbclient.c
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Required Headers */
|
||||
|
||||
#include "libwbclient.h"
|
||||
|
||||
/* From wb_common.c */
|
||||
|
||||
NSS_STATUS winbindd_request_response(int req_type,
|
||||
struct winbindd_request *request,
|
||||
struct winbindd_response *response);
|
||||
|
||||
/** @brief Wrapper around Winbind's send/receive API call
|
||||
*
|
||||
* @param cmd Winbind command operation to perform
|
||||
* @param request Send structure
|
||||
* @param response Receive structure
|
||||
*
|
||||
* @return #wbcErr
|
||||
**/
|
||||
|
||||
/**********************************************************************
|
||||
result == NSS_STATUS_UNAVAIL: winbind not around
|
||||
result == NSS_STATUS_NOTFOUND: winbind around, but domain missing
|
||||
|
||||
Due to a bad API NSS_STATUS_NOTFOUND is returned both when winbind_off
|
||||
and when winbind return WINBINDD_ERROR. So the semantics of this
|
||||
routine depends on winbind_on. Grepping for winbind_off I just
|
||||
found 3 places where winbind is turned off, and this does not conflict
|
||||
(as far as I have seen) with the callers of is_trusted_domains.
|
||||
|
||||
--Volker
|
||||
**********************************************************************/
|
||||
|
||||
wbcErr wbcRequestResponse(int cmd,
|
||||
struct winbindd_request *request,
|
||||
struct winbindd_response *response)
|
||||
{
|
||||
wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
|
||||
NSS_STATUS nss_status;
|
||||
|
||||
if (!request || !response) {
|
||||
wbc_status = WBC_ERR_INVALID_PARAM;
|
||||
BAIL_ON_WBC_ERROR(wbc_status);
|
||||
}
|
||||
|
||||
|
||||
nss_status = winbindd_request_response(cmd, request, response);
|
||||
|
||||
switch (nss_status) {
|
||||
case NSS_STATUS_SUCCESS:
|
||||
wbc_status = WBC_ERR_SUCCESS;
|
||||
break;
|
||||
case NSS_STATUS_UNAVAIL:
|
||||
return WBC_ERR_WINBIND_NOT_AVAILABLE;
|
||||
break;
|
||||
case NSS_STATUS_NOTFOUND:
|
||||
return WBC_ERR_DOMAIN_NOT_FOUND;
|
||||
break;
|
||||
default:
|
||||
wbc_status = WBC_ERR_NSS_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
done:
|
||||
return wbc_status;
|
||||
}
|
||||
|
||||
/** @brief Free library allocated memory
|
||||
*
|
||||
* @param *p Pointer to free
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
|
||||
void wbcFreeMemory(void *p)
|
||||
{
|
||||
if (p)
|
||||
talloc_free(p);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
184
source/nsswitch/libwbclient/wbclient.h
Normal file
184
source/nsswitch/libwbclient/wbclient.h
Normal file
@ -0,0 +1,184 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _WBCLIENT_H
|
||||
#define _WBCLIENT_H
|
||||
|
||||
#include <pwd.h>
|
||||
#include <nsswitch/libwbclient/wbc_err.h>
|
||||
|
||||
/*
|
||||
* Data types used by the Winbind Client API
|
||||
*/
|
||||
|
||||
#ifndef MAXSUBAUTHS
|
||||
#define MAXSUBAUTHS 15 /* max sub authorities in a SID */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Windows Security Identifier
|
||||
*
|
||||
**/
|
||||
|
||||
struct wbcDomainSid {
|
||||
uint8_t sid_rev_num;
|
||||
uint8_t num_auths;
|
||||
uint8_t id_auth[6];
|
||||
uint32_t sub_auths[MAXSUBAUTHS];
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Security Identifier type
|
||||
**/
|
||||
|
||||
enum wbcSidType {
|
||||
WBC_SID_NAME_USE_NONE=0,
|
||||
WBC_SID_NAME_USER=1,
|
||||
WBC_SID_NAME_DOM_GRP=2,
|
||||
WBC_SID_NAME_DOMAIN=3,
|
||||
WBC_SID_NAME_ALIAS=4,
|
||||
WBC_SID_NAME_WKN_GRP=5,
|
||||
WBC_SID_NAME_DELETED=6,
|
||||
WBC_SID_NAME_INVALID=7,
|
||||
WBC_SID_NAME_UNKNOWN=8,
|
||||
WBC_SID_NAME_COMPUTER=9
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Domain Information
|
||||
**/
|
||||
|
||||
struct wbcDomainInfo {
|
||||
char *short_name;
|
||||
char *dns_name;
|
||||
struct wbcDomainSid sid;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
/* wbcDomainInfo->flags */
|
||||
|
||||
#define WBC_DOMINFO_NATIVE 0x00000001
|
||||
#define WBC_DOMINFO_AD 0x00000002
|
||||
#define WBC_DOMINFO_PRIMARY 0x00000004
|
||||
|
||||
/*
|
||||
* Memory Management
|
||||
*/
|
||||
|
||||
void wbcFreeMemory(void*);
|
||||
|
||||
|
||||
/*
|
||||
* Utility functions for dealing with SIDs
|
||||
*/
|
||||
|
||||
wbcErr wbcSidToString(const struct wbcDomainSid *sid,
|
||||
char **sid_string);
|
||||
|
||||
wbcErr wbcStringToSid(const char *sid_string,
|
||||
struct wbcDomainSid *sid);
|
||||
|
||||
wbcErr wbcPing(void);
|
||||
|
||||
/*
|
||||
* Name/SID conversion
|
||||
*/
|
||||
|
||||
wbcErr wbcLookupName(const char *dom_name,
|
||||
const char *name,
|
||||
struct wbcDomainSid *sid,
|
||||
enum wbcSidType *name_type);
|
||||
|
||||
wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
|
||||
char **domain,
|
||||
char **name,
|
||||
enum wbcSidType *name_type);
|
||||
|
||||
wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
|
||||
int num_rids,
|
||||
uint32_t *rids,
|
||||
const char **domain_name,
|
||||
const char ***names,
|
||||
enum wbcSidType **types);
|
||||
|
||||
/*
|
||||
* SID/uid/gid Mappings
|
||||
*/
|
||||
|
||||
wbcErr wbcSidToUid(const struct wbcDomainSid *sid,
|
||||
uid_t *puid);
|
||||
|
||||
wbcErr wbcUidToSid(uid_t uid,
|
||||
struct wbcDomainSid *sid);
|
||||
|
||||
wbcErr wbcSidToGid(const struct wbcDomainSid *sid,
|
||||
gid_t *pgid);
|
||||
|
||||
wbcErr wbcGidToSid(gid_t gid,
|
||||
struct wbcDomainSid *sid);
|
||||
|
||||
wbcErr wbcAllocateUid(uid_t *puid);
|
||||
|
||||
wbcErr wbcAllocateGid(uid_t *pgid);
|
||||
|
||||
/*
|
||||
* NSS Lookup User/Group details
|
||||
*/
|
||||
|
||||
wbcErr wbcGetpwnam(const char *name, struct passwd **pwd);
|
||||
|
||||
wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd);
|
||||
|
||||
wbcErr wbcGetgrnam(const char *name, struct group **grp);
|
||||
|
||||
wbcErr wbcGetgrgid(gid_t gid, struct group **grp);
|
||||
|
||||
wbcErr wbcSetpwent(void);
|
||||
|
||||
wbcErr wbcEndpwent(void);
|
||||
|
||||
wbcErr wbcGetpwent(struct passwd **pwd);
|
||||
|
||||
wbcErr wbcSetgrent(void);
|
||||
|
||||
wbcErr wbcEndgrent(void);
|
||||
|
||||
wbcErr wbcGetgrent(struct group **grp);
|
||||
|
||||
|
||||
/*
|
||||
* Lookup Domain information
|
||||
*/
|
||||
|
||||
wbcErr wbcDomainInfo(const char *domain,
|
||||
struct wbcDomainInfo **info);
|
||||
|
||||
wbcErr wbcDomainSequenceNumbers(void);
|
||||
|
||||
/*
|
||||
* Athenticate functions
|
||||
*/
|
||||
|
||||
wbcErr wbcAuthenticateUser(const char *username,
|
||||
const char *password);
|
||||
|
||||
|
||||
#endif /* _WBCLIENT_H */
|
32
source/nsswitch/libwbclient/wbclient_internal.h
Normal file
32
source/nsswitch/libwbclient/wbclient_internal.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Winbind client API
|
||||
|
||||
Copyright (C) Gerald (Jerry) Carter 2007
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _WBCLIENT_INTERNAL_H
|
||||
#define _WBCLIENT_INTERNAL_H
|
||||
|
||||
/* Private functions */
|
||||
|
||||
wbcErr wbcRequestResponse(int cmd,
|
||||
struct winbindd_request *request,
|
||||
struct winbindd_response *response);
|
||||
|
||||
|
||||
#endif /* _WBCLIENT_INTERNAL_H */
|
@ -151,7 +151,7 @@ END {
|
||||
gotstart = 1;
|
||||
}
|
||||
|
||||
if( $0 ~ /^NODE_STATUS_STRUCT|^SMB_STRUCT_DIR|^ELOG_TDB|^codepoint_t|^_PUBLIC_/ ) {
|
||||
if( $0 ~ /^NODE_STATUS_STRUCT|^SMB_STRUCT_DIR|^ELOG_TDB|^codepoint_t|^_PUBLIC_|^wbcErr/ ) {
|
||||
gotstart = 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user