The branch, master has been updated via c5ae099 kerberos_util: Put into separate subsystem. via 539d5f5 auth: Remove unnecessary dependencies, fix formatting. via 5cbbe94 credentials: Move code that doesn't need any external dependencies into credentials.c. via 53db1f3 server: Add missing dependency on schannel database. via ffb6766 service: Add missing dependency on process_model. via 5324b94 wafsamba: Fix handling of pyembed/pyext. from 2bff55f dsdb/modules: Split up helpers a bit to prevent recursive dependencies.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit c5ae0991528dfeb3dbd1539f5c9c2ed2f19990b9 Author: Jelmer Vernooij <jel...@samba.org> Date: Mon Oct 11 01:28:45 2010 +0200 kerberos_util: Put into separate subsystem. Autobuild-User: Jelmer Vernooij <jel...@samba.org> Autobuild-Date: Mon Oct 11 00:34:56 UTC 2010 on sn-devel-104 commit 539d5f518da96d348529f6a87064c040a63ba298 Author: Jelmer Vernooij <jel...@samba.org> Date: Mon Oct 11 01:23:20 2010 +0200 auth: Remove unnecessary dependencies, fix formatting. commit 5cbbe943664aa428785fdffa1d1e5192decd4783 Author: Jelmer Vernooij <jel...@samba.org> Date: Mon Oct 11 01:20:42 2010 +0200 credentials: Move code that doesn't need any external dependencies into credentials.c. commit 53db1f34674ee161e102c4797f5ce5a9bee53350 Author: Jelmer Vernooij <jel...@samba.org> Date: Mon Oct 11 01:10:55 2010 +0200 server: Add missing dependency on schannel database. commit ffb67664230358ebdf3a35d9c9342ac5ecccc4c9 Author: Jelmer Vernooij <jel...@samba.org> Date: Sun Oct 10 19:14:20 2010 +0200 service: Add missing dependency on process_model. commit 5324b943e72d597da178d362f7c938fe0a4e57b0 Author: Jelmer Vernooij <jel...@samba.org> Date: Mon Oct 11 01:09:26 2010 +0200 wafsamba: Fix handling of pyembed/pyext. ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/wafsamba.py | 7 +- source4/auth/credentials/credentials.c | 147 ++++++++++++++++++++++++++ source4/auth/credentials/credentials_files.c | 131 ----------------------- source4/auth/credentials/credentials_krb5.c | 1 + source4/auth/credentials/credentials_ntlm.c | 13 --- source4/auth/credentials/wscript_build | 4 +- source4/auth/kerberos/kerberos_util.c | 3 +- source4/auth/kerberos/wscript_build | 6 + source4/auth/wscript_build | 4 +- source4/lib/ldb/wscript | 3 +- source4/lib/policy/wscript_build | 3 +- source4/librpc/wscript_build | 2 +- source4/param/wscript_build | 4 +- source4/scripting/python/wscript_build | 38 ++++---- source4/smbd/wscript_build | 4 +- source4/web_server/wscript_build | 23 ++-- 16 files changed, 201 insertions(+), 192 deletions(-) Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 414fdc6..e53472b 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -148,8 +148,8 @@ def SAMBA_LIBRARY(bld, libname, source, group = group, autoproto = autoproto, depends_on = depends_on, - pyembed = pyembed, hide_symbols = hide_symbols, + pyext = (target_type == "PYTHON"), local_include = local_include) if BUILTIN_LIBRARY(bld, libname): @@ -270,9 +270,9 @@ def SAMBA_BINARY(bld, binname, source, group = group, autoproto = autoproto, subsystem_name = subsystem_name, - pyembed = pyembed, local_include = local_include, use_hostcc = use_hostcc, + pyext = pyembed, use_global_deps= use_global_deps) bld.SET_BUILD_GROUP(group) @@ -409,7 +409,6 @@ def SAMBA_SUBSYSTEM(bld, modname, source, use_global_deps=True, vars=None, hide_symbols=False, - pyembed=False, pyext=False): '''define a Samba subsystem''' @@ -433,8 +432,6 @@ def SAMBA_SUBSYSTEM(bld, modname, source, bld.SET_BUILD_GROUP(group) features = 'cc' - if pyembed: - features += ' pyembed' if pyext: features += ' pyext' diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c index e1965b3..30ab46d 100644 --- a/source4/auth/credentials/credentials.c +++ b/source4/auth/credentials/credentials.c @@ -29,6 +29,7 @@ #include "libcli/auth/libcli_auth.h" #include "lib/events/events.h" #include "param/param.h" +#include "system/filesys.h" /** * Create a new credentials structure @@ -853,3 +854,149 @@ _PUBLIC_ bool cli_credentials_wrong_password(struct cli_credentials *cred) return (cred->tries > 0); } + +_PUBLIC_ void cli_credentials_get_ntlm_username_domain(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, + const char **username, + const char **domain) +{ + if (cred->principal_obtained > cred->username_obtained) { + *domain = talloc_strdup(mem_ctx, ""); + *username = cli_credentials_get_principal(cred, mem_ctx); + } else { + *domain = cli_credentials_get_domain(cred); + *username = cli_credentials_get_username(cred); + } +} + +/** + * Read a named file, and parse it for username, domain, realm and password + * + * @param credentials Credentials structure on which to set the password + * @param file a named file to read the details from + * @param obtained This enum describes how 'specified' this password is + */ + +_PUBLIC_ bool cli_credentials_parse_file(struct cli_credentials *cred, const char *file, enum credentials_obtained obtained) +{ + uint16_t len = 0; + char *ptr, *val, *param; + char **lines; + int i, numlines; + + lines = file_lines_load(file, &numlines, 0, NULL); + + if (lines == NULL) + { + /* fail if we can't open the credentials file */ + d_printf("ERROR: Unable to open credentials file!\n"); + return false; + } + + for (i = 0; i < numlines; i++) { + len = strlen(lines[i]); + + if (len == 0) + continue; + + /* break up the line into parameter & value. + * will need to eat a little whitespace possibly */ + param = lines[i]; + if (!(ptr = strchr_m (lines[i], '='))) + continue; + + val = ptr+1; + *ptr = '\0'; + + /* eat leading white space */ + while ((*val!='\0') && ((*val==' ') || (*val=='\t'))) + val++; + + if (strwicmp("password", param) == 0) { + cli_credentials_set_password(cred, val, obtained); + } else if (strwicmp("username", param) == 0) { + cli_credentials_set_username(cred, val, obtained); + } else if (strwicmp("domain", param) == 0) { + cli_credentials_set_domain(cred, val, obtained); + } else if (strwicmp("realm", param) == 0) { + cli_credentials_set_realm(cred, val, obtained); + } + memset(lines[i], 0, len); + } + + talloc_free(lines); + + return true; +} + +/** + * Read a named file, and parse it for a password + * + * @param credentials Credentials structure on which to set the password + * @param file a named file to read the password from + * @param obtained This enum describes how 'specified' this password is + */ + +_PUBLIC_ bool cli_credentials_parse_password_file(struct cli_credentials *credentials, const char *file, enum credentials_obtained obtained) +{ + int fd = open(file, O_RDONLY, 0); + bool ret; + + if (fd < 0) { + fprintf(stderr, "Error opening password file %s: %s\n", + file, strerror(errno)); + return false; + } + + ret = cli_credentials_parse_password_fd(credentials, fd, obtained); + + close(fd); + + return ret; +} + + +/** + * Read a file descriptor, and parse it for a password (eg from a file or stdin) + * + * @param credentials Credentials structure on which to set the password + * @param fd open file descriptor to read the password from + * @param obtained This enum describes how 'specified' this password is + */ + +_PUBLIC_ bool cli_credentials_parse_password_fd(struct cli_credentials *credentials, + int fd, enum credentials_obtained obtained) +{ + char *p; + char pass[128]; + + for(p = pass, *p = '\0'; /* ensure that pass is null-terminated */ + p && p - pass < sizeof(pass);) { + switch (read(fd, p, 1)) { + case 1: + if (*p != '\n' && *p != '\0') { + *++p = '\0'; /* advance p, and null-terminate pass */ + break; + } + /* fall through */ + case 0: + if (p - pass) { + *p = '\0'; /* null-terminate it, just in case... */ + p = NULL; /* then force the loop condition to become false */ + break; + } else { + fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, "empty password\n"); + return false; + } + + default: + fprintf(stderr, "Error reading password from file descriptor %d: %s\n", + fd, strerror(errno)); + return false; + } + } + + cli_credentials_set_password(credentials, pass, obtained); + return true; +} + + diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c index e1990a8..4a9ccf5 100644 --- a/source4/auth/credentials/credentials_files.c +++ b/source4/auth/credentials/credentials_files.c @@ -36,137 +36,6 @@ #include "dsdb/samdb/samdb.h" /** - * Read a file descriptor, and parse it for a password (eg from a file or stdin) - * - * @param credentials Credentials structure on which to set the password - * @param fd open file descriptor to read the password from - * @param obtained This enum describes how 'specified' this password is - */ - -_PUBLIC_ bool cli_credentials_parse_password_fd(struct cli_credentials *credentials, - int fd, enum credentials_obtained obtained) -{ - char *p; - char pass[128]; - - for(p = pass, *p = '\0'; /* ensure that pass is null-terminated */ - p && p - pass < sizeof(pass);) { - switch (read(fd, p, 1)) { - case 1: - if (*p != '\n' && *p != '\0') { - *++p = '\0'; /* advance p, and null-terminate pass */ - break; - } - /* fall through */ - case 0: - if (p - pass) { - *p = '\0'; /* null-terminate it, just in case... */ - p = NULL; /* then force the loop condition to become false */ - break; - } else { - fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, "empty password\n"); - return false; - } - - default: - fprintf(stderr, "Error reading password from file descriptor %d: %s\n", - fd, strerror(errno)); - return false; - } - } - - cli_credentials_set_password(credentials, pass, obtained); - return true; -} - -/** - * Read a named file, and parse it for a password - * - * @param credentials Credentials structure on which to set the password - * @param file a named file to read the password from - * @param obtained This enum describes how 'specified' this password is - */ - -_PUBLIC_ bool cli_credentials_parse_password_file(struct cli_credentials *credentials, const char *file, enum credentials_obtained obtained) -{ - int fd = open(file, O_RDONLY, 0); - bool ret; - - if (fd < 0) { - fprintf(stderr, "Error opening password file %s: %s\n", - file, strerror(errno)); - return false; - } - - ret = cli_credentials_parse_password_fd(credentials, fd, obtained); - - close(fd); - - return ret; -} - -/** - * Read a named file, and parse it for username, domain, realm and password - * - * @param credentials Credentials structure on which to set the password - * @param file a named file to read the details from - * @param obtained This enum describes how 'specified' this password is - */ - -_PUBLIC_ bool cli_credentials_parse_file(struct cli_credentials *cred, const char *file, enum credentials_obtained obtained) -{ - uint16_t len = 0; - char *ptr, *val, *param; - char **lines; - int i, numlines; - - lines = file_lines_load(file, &numlines, 0, NULL); - - if (lines == NULL) - { - /* fail if we can't open the credentials file */ - d_printf("ERROR: Unable to open credentials file!\n"); - return false; - } - - for (i = 0; i < numlines; i++) { - len = strlen(lines[i]); - - if (len == 0) - continue; - - /* break up the line into parameter & value. - * will need to eat a little whitespace possibly */ - param = lines[i]; - if (!(ptr = strchr_m (lines[i], '='))) - continue; - - val = ptr+1; - *ptr = '\0'; - - /* eat leading white space */ - while ((*val!='\0') && ((*val==' ') || (*val=='\t'))) - val++; - - if (strwicmp("password", param) == 0) { - cli_credentials_set_password(cred, val, obtained); - } else if (strwicmp("username", param) == 0) { - cli_credentials_set_username(cred, val, obtained); - } else if (strwicmp("domain", param) == 0) { - cli_credentials_set_domain(cred, val, obtained); - } else if (strwicmp("realm", param) == 0) { - cli_credentials_set_realm(cred, val, obtained); - } - memset(lines[i], 0, len); - } - - talloc_free(lines); - - return true; -} - - -/** * Fill in credentials for the machine trust account, from the secrets database. * * @param cred Credentials structure to fill in diff --git a/source4/auth/credentials/credentials_krb5.c b/source4/auth/credentials/credentials_krb5.c index 6e11a5f..c678b80 100644 --- a/source4/auth/credentials/credentials_krb5.c +++ b/source4/auth/credentials/credentials_krb5.c @@ -28,6 +28,7 @@ #include "auth/credentials/credentials_proto.h" #include "auth/credentials/credentials_krb5.h" #include "auth/kerberos/kerberos_credentials.h" +#include "auth/kerberos/kerberos_util.h" #include "param/param.h" _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred, diff --git a/source4/auth/credentials/credentials_ntlm.c b/source4/auth/credentials/credentials_ntlm.c index ef41971..7f4af4f 100644 --- a/source4/auth/credentials/credentials_ntlm.c +++ b/source4/auth/credentials/credentials_ntlm.c @@ -27,19 +27,6 @@ #include "libcli/auth/libcli_auth.h" #include "auth/credentials/credentials.h" -_PUBLIC_ void cli_credentials_get_ntlm_username_domain(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, - const char **username, - const char **domain) -{ - if (cred->principal_obtained > cred->username_obtained) { - *domain = talloc_strdup(mem_ctx, ""); - *username = cli_credentials_get_principal(cred, mem_ctx); - } else { - *domain = cli_credentials_get_domain(cred); - *username = cli_credentials_get_username(cred); - } -} - _PUBLIC_ NTSTATUS cli_credentials_get_ntlm_response(struct cli_credentials *cred, TALLOC_CTX *mem_ctx, int *flags, DATA_BLOB challenge, DATA_BLOB target_info, diff --git a/source4/auth/credentials/wscript_build b/source4/auth/credentials/wscript_build index fad29c8..a8ef95f 100644 --- a/source4/auth/credentials/wscript_build +++ b/source4/auth/credentials/wscript_build @@ -1,9 +1,9 @@ #!/usr/bin/env python bld.SAMBA_SUBSYSTEM('CREDENTIALS', - source='credentials.c credentials_files.c credentials_ntlm.c credentials_krb5.c ../kerberos/kerberos_util.c', + source='credentials.c credentials_files.c credentials_ntlm.c credentials_krb5.c', autoproto='credentials_proto.h', - public_deps='LIBCLI_AUTH SECRETS LIBCRYPTO KERBEROS UTIL_LDB gssapi com_err', + public_deps='LIBCLI_AUTH SECRETS LIBCRYPTO KERBEROS KERBEROS_UTIL UTIL_LDB gssapi com_err', public_headers='credentials.h', deps='SECRETS SAMDB' ) diff --git a/source4/auth/kerberos/kerberos_util.c b/source4/auth/kerberos/kerberos_util.c index 27cbeb0..3020e97 100644 --- a/source4/auth/kerberos/kerberos_util.c +++ b/source4/auth/kerberos/kerberos_util.c @@ -27,7 +27,8 @@ #include "auth/credentials/credentials_proto.h" #include "auth/credentials/credentials_krb5.h" #include "auth/kerberos/kerberos_credentials.h" -#include "ldb.h" +#include "auth/kerberos/kerberos_util.h" +#include <ldb.h> #include "param/secrets.h" struct principal_container { diff --git a/source4/auth/kerberos/wscript_build b/source4/auth/kerberos/wscript_build index 0c1828a..f5f615c 100644 --- a/source4/auth/kerberos/wscript_build +++ b/source4/auth/kerberos/wscript_build @@ -7,3 +7,9 @@ bld.SAMBA_SUBSYSTEM('KERBEROS', deps='ASN1_UTIL auth_sam_reply tevent LIBPACKET LIBNDR' ) +bld.SAMBA_SUBSYSTEM('KERBEROS_UTIL', + autoproto='kerberos_util.h', + source='kerberos_util.c', + deps='KERBEROS com_err ldb SECRETS', + ) + diff --git a/source4/auth/wscript_build b/source4/auth/wscript_build index db8fdf8..38fb1b7 100644 --- a/source4/auth/wscript_build +++ b/source4/auth/wscript_build @@ -11,7 +11,7 @@ bld.SAMBA_SUBSYSTEM('auth_session', autoproto='session_proto.h', public_deps='CREDENTIALS', public_headers='session.h', - header_path='samba', + header_path='samba', deps='SAMDB auth_sam' ) @@ -26,7 +26,7 @@ bld.SAMBA_SUBSYSTEM('auth_system_session', source='system_session.c', autoproto='system_session_proto.h', public_deps='CREDENTIALS', - deps='auth_session LIBSAMBA-UTIL LIBSECURITY' + deps='auth_session', ) diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript index fffd8ce..67b25b4 100644 --- a/source4/lib/ldb/wscript +++ b/source4/lib/ldb/wscript @@ -107,8 +107,7 @@ def build(bld): else: abi_file = 'ABI/ldb-%s.sigs' % VERSION - bld.SAMBA_SUBSYSTEM('pyldb_util', deps='ldb', - source='pyldb_util.c', pyembed=True) + bld.SAMBA_SUBSYSTEM('pyldb_util', deps='ldb', source='pyldb_util.c', pyext=True) if not bld.CONFIG_SET('USING_SYSTEM_LDB'): modules_dir = bld.EXPAND_VARIABLES('${LDB_MODULESDIR}') diff --git a/source4/lib/policy/wscript_build b/source4/lib/policy/wscript_build index aa7feee..3daa91e 100644 --- a/source4/lib/policy/wscript_build +++ b/source4/lib/policy/wscript_build @@ -5,7 +5,8 @@ bld.SAMBA_LIBRARY('policy', pc_files='policy.pc', public_deps='ldb LIBSAMBA-NET', public_headers='policy.h', - vnum='0.0.1' + vnum='0.0.1', + pyembed=True ) bld.SAMBA_PYTHON('py_policy', diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build index 617387e..665eb1e 100755 --- a/source4/librpc/wscript_build +++ b/source4/librpc/wscript_build @@ -174,7 +174,7 @@ bld.SAMBA_LIBRARY('dcerpc', bld.SAMBA_SUBSYSTEM('pyrpc_util', source='rpc/pyrpc_util.c', public_deps='PYTALLOC pyparam_util pycredentials dcerpc', - pyembed=True, + pyext=True, ) diff --git a/source4/param/wscript_build b/source4/param/wscript_build index 6532782..3595d0b 100644 --- a/source4/param/wscript_build +++ b/source4/param/wscript_build @@ -14,7 +14,7 @@ bld.SAMBA_LIBRARY('LIBSAMBA-HOSTCONFIG', bld.SAMBA_SUBSYSTEM('PROVISION', source='provision.c pyparam.c', deps='LIBPYTHON pyparam_util ldb PYTALLOC', - pyembed=True, + pyext=True, ) -- Samba Shared Repository