From ad2974cd05b4d08c8b92f505bf95aa8e8533235f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 24 Nov 2001 14:16:41 +0000 Subject: added "net join" command this completes the first stage of the smbd ADS support (This used to be commit 058a5aee901e6609969ef7e1d482a720a84a4a12) --- source3/CodingSuggestions | 17 ++ source3/Makefile.in | 10 +- source3/client/client.c | 2 +- source3/groupdb/mapping.c | 4 +- source3/include/includes.h | 7 + source3/include/secrets.h | 6 + source3/lib/util_sock.c | 31 ++++ source3/libads/kerberos.c | 149 +++++++++++++++++ source3/libads/krb5_setpw.c | 352 +++++++++++++++++++++++++++++++++++++++++ source3/libads/ldap.c | 103 ++++++++++-- source3/libsmb/clikrb5.c | 7 + source3/param/loadparm.c | 3 + source3/passdb/secrets.c | 36 ++++- source3/printing/nt_printing.c | 3 +- source3/rpcclient/cmd_lsarpc.c | 2 - source3/script/mkproto.awk | 2 +- source3/smbd/sesssetup.c | 43 +---- source3/utils/net.c | 233 ++++++--------------------- source3/utils/net_join.c | 143 +++++++++++++++++ 19 files changed, 902 insertions(+), 251 deletions(-) create mode 100644 source3/libads/kerberos.c create mode 100644 source3/libads/krb5_setpw.c create mode 100644 source3/utils/net_join.c (limited to 'source3') diff --git a/source3/CodingSuggestions b/source3/CodingSuggestions index 60a358919a..48c51281f5 100644 --- a/source3/CodingSuggestions +++ b/source3/CodingSuggestions @@ -115,6 +115,23 @@ Here are some other suggestions: comment start / ** so that they can be picked up by Doxygen, as in this file. +23) Keep the scope narrow. This means making functions/variables + static whenever possible. We don't want our namespace + polluted. Each module should have a minimal number of externally + visible functions or variables. + +24) Use function pointers to keep knowledge about particular pieces of + code isolated in one place. We don't want a particular piece of + functionality to be spread out across lots of places - that makes + for fragile, hand to maintain code. Instead, design an interface + and use tables containing function pointers to implement specific + functionality. This is particularly important for command + interpreters. + +25) Think carefully about what it will be like for someone else to add + to and maintain your code. If it would be hard for someone else to + maintain then do it another way. + The suggestions above are simply that, suggestions, but the information may help in reducing the routine rework done on new code. The preceeding list is expected to change routinely as new support routines and macros are diff --git a/source3/Makefile.in b/source3/Makefile.in index 6b3b337a12..8a29a1f0ff 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -131,7 +131,7 @@ UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \ PARAM_OBJ = param/loadparm.o param/params.o dynconfig.o -LIBADS_OBJ = libads/ldap.o +LIBADS_OBJ = libads/ldap.o libads/krb5_setpw.o libads/kerberos.o passdb/secrets.o LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \ libsmb/clikrb5.o libsmb/clispnego.o libsmb/asn1.o \ @@ -179,7 +179,7 @@ RPC_CLIENT_OBJ = rpc_client/cli_netlogon.o rpc_client/cli_pipe.o \ LOCKING_OBJ = locking/locking.o locking/brlock.o locking/posix.o -PASSDB_OBJ = passdb/passdb.o passdb/secrets.o \ +PASSDB_OBJ = passdb/passdb.o \ passdb/machine_sid.o passdb/pdb_smbpasswd.o \ passdb/pdb_tdb.o passdb/pdb_ldap.o \ passdb/pdb_nisplus.o @@ -319,8 +319,8 @@ CLIENT_OBJ = client/client.o client/clitar.o \ $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \ $(READLINE_OBJ) -NET_OBJ = utils/net.o $(LIBSMB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \ - @BUILD_POPT@ +NET_OBJ = utils/net.o utils/net_join.o \ + $(LIBSMB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) @BUILD_POPT@ CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) @@ -375,7 +375,7 @@ SMBFILTER_OBJ = utils/smbfilter.o $(LIBSMB_OBJ) $(PARAM_OBJ) \ PROTO_OBJ = $(SMBD_OBJ) $(NMBD_OBJ) $(SWAT_OBJ) $(CLIENT_OBJ) \ $(SMBWRAPPER_OBJ) $(SMBTORTURE_OBJ) $(RPCCLIENT_OBJ1) \ - $(LIBMSRPC_OBJ) $(RPC_CLIENT_OBJ) $(AUTH_OBJ) + $(LIBMSRPC_OBJ) $(RPC_CLIENT_OBJ) $(AUTH_OBJ) $(NET_OBJ) NSS_OBJ_0 = nsswitch/wins.o $(PARAM_OBJ) $(UBIQX_OBJ) $(LIBSMB_OBJ) $(LIB_OBJ) $(NSSWINS_OBJ) NSS_OBJ = $(NSS_OBJ_0:.o=.po) diff --git a/source3/client/client.c b/source3/client/client.c index 7baab4b204..c684f3fea6 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -2159,7 +2159,7 @@ struct cli_state *do_connect(const char *server, const char *share) password, strlen(password), workgroup)) { /* if a password was not supplied then try again with a null username */ - if (password[0] || !username[0] || + if (password[0] || !username[0] || use_kerberos || !cli_session_setup(c, "", "", 0, "", 0, workgroup)) { d_printf("session setup failed: %s\n", cli_errstr(c)); cli_shutdown(c); diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index 92a98ff7a4..c39bb8cdff 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -233,7 +233,7 @@ add a privilege to a privilege array ****************************************************************************/ BOOL add_privilege(uint32 *privilege, uint32 priv) { - int i; + int i=0; while (i