diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-01-21 18:40:06 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-01-21 18:40:06 +0100 |
commit | 715cc00bc01e151c10e3d723cd29e126a6464637 (patch) | |
tree | 538017d459e7531a726e34767c0abcbe5e683faa | |
parent | 293acaf92e7234665e15c3fb7fd600427ffcd5ce (diff) | |
parent | a868d2f3d5281dea923718486e4e42b20cf8fe74 (diff) | |
download | samba-715cc00bc01e151c10e3d723cd29e126a6464637.tar.gz samba-715cc00bc01e151c10e3d723cd29e126a6464637.tar.bz2 samba-715cc00bc01e151c10e3d723cd29e126a6464637.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba
-rw-r--r-- | lib/smbconf/smbconf.c (renamed from source3/lib/smbconf/smbconf.c) | 30 | ||||
-rw-r--r-- | lib/smbconf/smbconf.h (renamed from source3/lib/smbconf/smbconf.h) | 20 | ||||
-rw-r--r-- | lib/smbconf/smbconf_private.h (renamed from source3/lib/smbconf/smbconf_private.h) | 0 | ||||
-rw-r--r-- | lib/smbconf/smbconf_txt.c (renamed from source3/lib/smbconf/smbconf_txt.c) | 11 | ||||
-rw-r--r-- | lib/smbconf/smbconf_txt.h | 33 | ||||
-rw-r--r-- | lib/smbconf/smbconf_util.c (renamed from source3/lib/smbconf/smbconf_util.c) | 4 | ||||
-rw-r--r-- | m4/check_python.m4 (renamed from source4/build/m4/check_python.m4) | 0 | ||||
-rw-r--r-- | source3/Makefile.in | 5 | ||||
-rw-r--r-- | source3/configure.in | 2 | ||||
-rw-r--r-- | source3/include/includes.h | 3 | ||||
-rw-r--r-- | source3/lib/ldb/tools/ldbdel.c | 4 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_init.c | 6 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_init.h | 32 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 42 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.h | 33 | ||||
-rw-r--r-- | source3/lib/smbconf/testsuite.c | 10 | ||||
-rw-r--r-- | source3/modules/vfs_extd_audit.c | 145 | ||||
-rw-r--r-- | source4/build/m4/env.m4 | 2 |
18 files changed, 234 insertions, 148 deletions
diff --git a/source3/lib/smbconf/smbconf.c b/lib/smbconf/smbconf.c index 86c1692574..d723f0b140 100644 --- a/source3/lib/smbconf/smbconf.c +++ b/lib/smbconf/smbconf.c @@ -60,37 +60,11 @@ bool smbconf_is_writeable(struct smbconf_ctx *ctx) } /** - * utitlity function: - * check whether a config source is writeable, - * given only the name of the config source. - */ -bool smbconf_is_writeable_bystring(const char *configsource) -{ - struct smbconf_ctx *conf_ctx; - WERROR err; - bool ret; - TALLOC_CTX *mem_ctx = talloc_stackframe; - - err = smbconf_init_reg(mem_ctx, &conf_ctx, configsource); - if (!W_ERROR_IS_OK(err)) { - ret = false; - goto done; - } - - ret = smbconf_is_writeable(conf_ctx); - -done: - smbconf_shutdown(conf_ctx); - TALLOC_FREE(mem_ctx); - return ret; -} - -/** * Close the configuration. */ void smbconf_shutdown(struct smbconf_ctx *ctx) { - TALLOC_FREE(ctx); + talloc_free(ctx); } /** @@ -183,7 +157,7 @@ WERROR smbconf_get_config(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } diff --git a/source3/lib/smbconf/smbconf.h b/lib/smbconf/smbconf.h index f65842ee34..106fae6431 100644 --- a/source3/lib/smbconf/smbconf.h +++ b/lib/smbconf/smbconf.h @@ -34,31 +34,11 @@ struct smbconf_service { char **param_values; }; - -/** - * intialization dispatcher function. - * takes source string in the form of "backend:path" - */ -WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, - const char *source); - -/** - * initialization functions for the available modules - */ - -WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, - const char *path); - -WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx, - struct smbconf_ctx **conf_ctx, - const char *path); - /* * the smbconf API functions */ bool smbconf_backend_requires_messaging(struct smbconf_ctx *ctx); bool smbconf_is_writeable(struct smbconf_ctx *ctx); -bool smbconf_is_writeable_bystring(const char *configsource); void smbconf_shutdown(struct smbconf_ctx *ctx); bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, const char *service, const char *param); diff --git a/source3/lib/smbconf/smbconf_private.h b/lib/smbconf/smbconf_private.h index b0333e981a..b0333e981a 100644 --- a/source3/lib/smbconf/smbconf_private.h +++ b/lib/smbconf/smbconf_private.h diff --git a/source3/lib/smbconf/smbconf_txt.c b/lib/smbconf/smbconf_txt.c index 70d5f82bf0..c4d2d2b1af 100644 --- a/source3/lib/smbconf/smbconf_txt.c +++ b/lib/smbconf/smbconf_txt.c @@ -138,7 +138,7 @@ static bool smbconf_txt_do_parameter(const char *param_name, if (!(tpd->verbatim) && smbconf_find_in_array(param_name, param_names, num_params, &idx)) { - TALLOC_FREE(param_values[idx]); + talloc_free(param_values[idx]); param_values[idx] = talloc_strdup(cache, param_value); if (param_values[idx] == NULL) { return false; @@ -160,7 +160,8 @@ static bool smbconf_txt_do_parameter(const char *param_name, static void smbconf_txt_flush_cache(struct smbconf_ctx *ctx) { - TALLOC_FREE(pd(ctx)->cache); + talloc_free(pd(ctx)->cache); + pd(ctx)->cache = NULL; } static WERROR smbconf_txt_init_cache(struct smbconf_ctx *ctx) @@ -359,7 +360,7 @@ static WERROR smbconf_txt_get_share_names(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -458,7 +459,7 @@ static WERROR smbconf_txt_get_share(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -593,7 +594,7 @@ static WERROR smbconf_txt_get_includes(struct smbconf_ctx *ctx, werr = WERR_OK; done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } diff --git a/lib/smbconf/smbconf_txt.h b/lib/smbconf/smbconf_txt.h new file mode 100644 index 0000000000..688bbc9d48 --- /dev/null +++ b/lib/smbconf/smbconf_txt.h @@ -0,0 +1,33 @@ +/* + * Unix SMB/CIFS implementation. + * libsmbconf - Samba configuration library + * Copyright (C) Michael Adam 2009 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __LIBSMBCONF_TXT_H__ +#define __LIBSMBCONF_TXT_H__ + +struct smbconf_ctx; + +/** + * initialization functions for the text/file backend modules + */ + +WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx, + struct smbconf_ctx **conf_ctx, + const char *path); + +#endif /* _LIBSMBCONF_TXT_H_ */ diff --git a/source3/lib/smbconf/smbconf_util.c b/lib/smbconf/smbconf_util.c index 271fc47dd4..5eb5e963ed 100644 --- a/source3/lib/smbconf/smbconf_util.c +++ b/lib/smbconf/smbconf_util.c @@ -67,7 +67,7 @@ WERROR smbconf_init_internal(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, return werr; fail: - TALLOC_FREE(ctx); + talloc_free(ctx); return werr; } @@ -96,7 +96,7 @@ WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, } else { new_array[count] = talloc_strdup(new_array, string); if (new_array[count] == NULL) { - TALLOC_FREE(new_array); + talloc_free(new_array); return WERR_NOMEM; } } diff --git a/source4/build/m4/check_python.m4 b/m4/check_python.m4 index 7e56af76f7..7e56af76f7 100644 --- a/source4/build/m4/check_python.m4 +++ b/m4/check_python.m4 diff --git a/source3/Makefile.in b/source3/Makefile.in index 08ba0ad32a..1924ade8fb 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -856,9 +856,10 @@ CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ $(DISPLAY_SEC_OBJ) -LIBSMBCONF_OBJ = lib/smbconf/smbconf.o lib/smbconf/smbconf_util.o \ +LIBSMBCONF_OBJ = ../lib/smbconf/smbconf.o \ + ../lib/smbconf/smbconf_util.o \ + ../lib/smbconf/smbconf_txt.o \ lib/smbconf/smbconf_reg.o \ - lib/smbconf/smbconf_txt.o \ lib/smbconf/smbconf_init.o SMBCONFTORT_OBJ0 = lib/smbconf/testsuite.o diff --git a/source3/configure.in b/source3/configure.in index f1004778f4..87b4c33417 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6286,7 +6286,7 @@ m4_include(../lib/zlib/zlib.m4) if test x$enable_merged_build = xauto; then # Check for python - m4_include(../source4/build/m4/check_python.m4) + m4_include(../m4/check_python.m4) AC_SAMBA_PYTHON_DEVEL([true], [merged_build_possible=no]) AC_MSG_CHECKING([whether it would be possible to do a merged build]) diff --git a/source3/include/includes.h b/source3/include/includes.h index 63b567d419..9c7f15b9cb 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -654,6 +654,9 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx); #include "eventlog.h" #include "lib/smbconf/smbconf.h" +#include "lib/smbconf/smbconf_init.h" +#include "lib/smbconf/smbconf_reg.h" +#include "lib/smbconf/smbconf_txt.h" /* Defines for wisXXX functions. */ #define UNI_UPPER 0x1 diff --git a/source3/lib/ldb/tools/ldbdel.c b/source3/lib/ldb/tools/ldbdel.c index cafe0bd352..c58a82a523 100644 --- a/source3/lib/ldb/tools/ldbdel.c +++ b/source3/lib/ldb/tools/ldbdel.c @@ -35,7 +35,7 @@ #include "ldb/include/includes.h" #include "ldb/tools/cmdline.h" -static int ldb_delete_recursive(struct ldb_context *ldb, const struct ldb_dn *dn) +static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn) { int ret, i, total=0; const char *attrs[] = { NULL }; @@ -90,7 +90,7 @@ int main(int argc, const char **argv) } for (i=0;i<options->argc;i++) { - const struct ldb_dn *dn; + struct ldb_dn *dn; dn = ldb_dn_explode(ldb, options->argv[i]); if (dn == NULL) { diff --git a/source3/lib/smbconf/smbconf_init.c b/source3/lib/smbconf/smbconf_init.c index a362a663af..58bb9d9362 100644 --- a/source3/lib/smbconf/smbconf_init.c +++ b/source3/lib/smbconf/smbconf_init.c @@ -18,7 +18,9 @@ */ #include "includes.h" -#include "smbconf_private.h" +#include "lib/smbconf/smbconf_private.h" +#include "lib/smbconf/smbconf_txt.h" +#include "lib/smbconf/smbconf_reg.h" /** * smbconf initialization dispatcher @@ -88,6 +90,6 @@ WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } diff --git a/source3/lib/smbconf/smbconf_init.h b/source3/lib/smbconf/smbconf_init.h new file mode 100644 index 0000000000..abd62df204 --- /dev/null +++ b/source3/lib/smbconf/smbconf_init.h @@ -0,0 +1,32 @@ +/* + * Unix SMB/CIFS implementation. + * libsmbconf - Samba configuration library + * Copyright (C) Michael Adam 2009 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __LIBSMBCONF_INIT_H__ +#define __LIBSMBCONF_INIT_H__ + +struct smbconf_ctx; + +/** + * intialization dispatcher function. + * takes source string in the form of "backend:path" + */ +WERROR smbconf_init(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, + const char *source); + +#endif /* _LIBSMBCONF_INIT_H_ */ diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index cae16ad2e5..e36fa8a2a1 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -18,7 +18,7 @@ */ #include "includes.h" -#include "smbconf_private.h" +#include "lib/smbconf/smbconf_private.h" #define INCLUDES_VALNAME "includes" @@ -145,7 +145,7 @@ static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx, werr = smbconf_reg_open_path(mem_ctx, ctx, path, desired_access, key); done: - TALLOC_FREE(path); + talloc_free(path); return werr; } @@ -176,7 +176,7 @@ static bool smbconf_value_exists(struct registry_key *key, const char *param) ret = true; } - TALLOC_FREE(ctx); + talloc_free(ctx); return ret; } @@ -216,7 +216,7 @@ static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx, } done: - TALLOC_FREE(create_ctx); + talloc_free(create_ctx); return werr; } @@ -331,7 +331,7 @@ static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -436,7 +436,7 @@ static WERROR smbconf_reg_get_includes_internal(TALLOC_CTX *mem_ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -533,7 +533,7 @@ static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -592,7 +592,7 @@ static WERROR smbconf_reg_delete_values(struct registry_key *key) werr = WERR_OK; done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -748,7 +748,7 @@ static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx) &new_key, &action); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -833,7 +833,7 @@ static WERROR smbconf_reg_get_share_names(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -854,7 +854,7 @@ static bool smbconf_reg_share_exists(struct smbconf_ctx *ctx, ret = true; } - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return ret; } @@ -876,7 +876,7 @@ static WERROR smbconf_reg_create_share(struct smbconf_ctx *ctx, servicename, &key); } - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -923,7 +923,7 @@ static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -949,7 +949,7 @@ static WERROR smbconf_reg_delete_share(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -974,7 +974,7 @@ static WERROR smbconf_reg_set_parameter(struct smbconf_ctx *ctx, werr = smbconf_reg_set_value(key, param, valstr); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -1019,8 +1019,8 @@ static WERROR smbconf_reg_get_parameter(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(key); - TALLOC_FREE(value); + talloc_free(key); + talloc_free(value); return werr; } @@ -1054,7 +1054,7 @@ static WERROR smbconf_reg_delete_parameter(struct smbconf_ctx *ctx, werr = reg_deletevalue(key, param); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return werr; } @@ -1078,7 +1078,7 @@ static WERROR smbconf_reg_get_includes(struct smbconf_ctx *ctx, includes); done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -1108,7 +1108,7 @@ static WERROR smbconf_reg_set_includes(struct smbconf_ctx *ctx, } done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } @@ -1133,7 +1133,7 @@ static WERROR smbconf_reg_delete_includes(struct smbconf_ctx *ctx, done: - TALLOC_FREE(tmp_ctx); + talloc_free(tmp_ctx); return werr; } diff --git a/source3/lib/smbconf/smbconf_reg.h b/source3/lib/smbconf/smbconf_reg.h new file mode 100644 index 0000000000..7f54b6e32d --- /dev/null +++ b/source3/lib/smbconf/smbconf_reg.h @@ -0,0 +1,33 @@ +/* + * Unix SMB/CIFS implementation. + * libsmbconf - Samba configuration library + * Copyright (C) Michael Adam 2009 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __LIBSMBCONF_REG_H__ +#define __LIBSMBCONF_REG_H__ + +struct smbconf_ctx; + +/** + * initialization functions for the registry backend modules + */ + +WERROR smbconf_init_reg(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx, + const char *path); + + +#endif /* _LIBSMBCONF_REG_H_ */ diff --git a/source3/lib/smbconf/testsuite.c b/source3/lib/smbconf/testsuite.c index edc9a7ffac..3d3c2d0ff0 100644 --- a/source3/lib/smbconf/testsuite.c +++ b/source3/lib/smbconf/testsuite.c @@ -57,7 +57,7 @@ static bool test_get_includes(struct smbconf_ctx *ctx) ret = true; done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return ret; } @@ -114,7 +114,7 @@ static bool test_set_get_includes(struct smbconf_ctx *ctx) ret = true; done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return ret; } @@ -235,7 +235,7 @@ static bool torture_smbconf_txt(void) printf("%s: text backend\n", ret ? "success" : "failure"); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return ret; } @@ -266,7 +266,7 @@ static bool torture_smbconf_reg(void) printf("%s: registry backend\n", ret ? "success" : "failure"); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return ret; } @@ -315,6 +315,6 @@ int main(int argc, const char **argv) ret = torture_smbconf(); done: - TALLOC_FREE(mem_ctx); + talloc_free(mem_ctx); return ret ? 0 : -1; } diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c index 7516cba1d3..d7c9d39c5e 100644 --- a/source3/modules/vfs_extd_audit.c +++ b/source3/modules/vfs_extd_audit.c @@ -132,8 +132,11 @@ static int audit_connect(vfs_handle_struct *handle, const char *svc, const char openlog("smbd_audit", LOG_PID, audit_syslog_facility(handle)); - syslog(audit_syslog_priority(handle), "connect to service %s by user %s\n", - svc, user); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), + "connect to service %s by user %s\n", + svc, user); + } DEBUG(10, ("Connected to service %s as user %s\n", svc, user)); @@ -144,7 +147,9 @@ static int audit_connect(vfs_handle_struct *handle, const char *svc, const char static void audit_disconnect(vfs_handle_struct *handle) { - syslog(audit_syslog_priority(handle), "disconnected\n"); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "disconnected\n"); + } DEBUG(10, ("Disconnected from VFS module extd_audit\n")); SMB_VFS_NEXT_DISCONNECT(handle); @@ -157,10 +162,12 @@ static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, const char *fnam result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr); - syslog(audit_syslog_priority(handle), "opendir %s %s%s\n", - fname, - (result == NULL) ? "failed: " : "", - (result == NULL) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "opendir %s %s%s\n", + fname, + (result == NULL) ? "failed: " : "", + (result == NULL) ? strerror(errno) : ""); + } DEBUG(1, ("vfs_extd_audit: opendir %s %s %s\n", fname, (result == NULL) ? "failed: " : "", @@ -172,13 +179,15 @@ static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, const char *fnam static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) { int result; - + result = SMB_VFS_NEXT_MKDIR(handle, path, mode); - - syslog(audit_syslog_priority(handle), "mkdir %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "mkdir %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(0, ("vfs_extd_audit: mkdir %s %s %s\n", path, (result < 0) ? "failed: " : "", @@ -190,13 +199,15 @@ static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) static int audit_rmdir(vfs_handle_struct *handle, const char *path) { int result; - + result = SMB_VFS_NEXT_RMDIR(handle, path); - syslog(audit_syslog_priority(handle), "rmdir %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "rmdir %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(0, ("vfs_extd_audit: rmdir %s %s %s\n", path, (result < 0) ? "failed: " : "", @@ -208,14 +219,16 @@ static int audit_rmdir(vfs_handle_struct *handle, const char *path) static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode) { int result; - + result = SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode); - syslog(audit_syslog_priority(handle), "open %s (fd %d) %s%s%s\n", - fname, result, - ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "open %s (fd %d) %s%s%s\n", + fname, result, + ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(2, ("vfs_extd_audit: open %s %s %s\n", fname, (result < 0) ? "failed: " : "", @@ -227,13 +240,15 @@ static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct static int audit_close(vfs_handle_struct *handle, files_struct *fsp) { int result; - + result = SMB_VFS_NEXT_CLOSE(handle, fsp); - syslog(audit_syslog_priority(handle), "close fd %d %s%s\n", - fsp->fh->fd, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "close fd %d %s%s\n", + fsp->fh->fd, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(2, ("vfs_extd_audit: close fd %d %s %s\n", fsp->fh->fd, (result < 0) ? "failed: " : "", @@ -245,31 +260,35 @@ static int audit_close(vfs_handle_struct *handle, files_struct *fsp) static int audit_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) { int result; - + result = SMB_VFS_NEXT_RENAME(handle, oldname, newname); - syslog(audit_syslog_priority(handle), "rename %s -> %s %s%s\n", - oldname, newname, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "rename %s -> %s %s%s\n", + oldname, newname, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(1, ("vfs_extd_audit: rename old: %s newname: %s %s %s\n", oldname, newname, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : "")); - return result; + return result; } static int audit_unlink(vfs_handle_struct *handle, const char *path) { int result; - + result = SMB_VFS_NEXT_UNLINK(handle, path); - syslog(audit_syslog_priority(handle), "unlink %s %s%s\n", - path, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "unlink %s %s%s\n", + path, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(0, ("vfs_extd_audit: unlink %s %s %s\n", path, (result < 0) ? "failed: " : "", @@ -284,10 +303,12 @@ static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) result = SMB_VFS_NEXT_CHMOD(handle, path, mode); - syslog(audit_syslog_priority(handle), "chmod %s mode 0x%x %s%s\n", - path, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "chmod %s mode 0x%x %s%s\n", + path, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(1, ("vfs_extd_audit: chmod %s mode 0x%x %s %s\n", path, mode, (result < 0) ? "failed: " : "", @@ -299,13 +320,15 @@ static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode) { int result; - + result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode); - syslog(audit_syslog_priority(handle), "chmod_acl %s mode 0x%x %s%s\n", - path, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "chmod_acl %s mode 0x%x %s%s\n", + path, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(1, ("vfs_extd_audit: chmod_acl %s mode 0x%x %s %s\n", path, mode, (result < 0) ? "failed: " : "", @@ -317,13 +340,15 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; - + result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); - syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n", - fsp->fsp_name, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n", + fsp->fsp_name, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(1, ("vfs_extd_audit: fchmod %s mode 0x%x %s %s", fsp->fsp_name, mode, (result < 0) ? "failed: " : "", @@ -335,13 +360,15 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; - + result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); - syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n", - fsp->fsp_name, mode, - (result < 0) ? "failed: " : "", - (result < 0) ? strerror(errno) : ""); + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n", + fsp->fsp_name, mode, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } DEBUG(1, ("vfs_extd_audit: fchmod_acl %s mode 0x%x %s %s", fsp->fsp_name, mode, (result < 0) ? "failed: " : "", diff --git a/source4/build/m4/env.m4 b/source4/build/m4/env.m4 index a988dd0f58..738ab8b1ae 100644 --- a/source4/build/m4/env.m4 +++ b/source4/build/m4/env.m4 @@ -73,7 +73,7 @@ AC_SUBST(automatic_dependencies) m4_include(build/m4/check_doc.m4) -m4_include(build/m4/check_python.m4) +m4_include(../m4/check_python.m4) AC_SAMBA_PYTHON_DEVEL([ SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS]) |