[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha6-749-ga45c5c6
Steven Danneman
sdanneman at samba.org
Tue Feb 10 22:43:42 GMT 2009
The branch, master has been updated
via a45c5c607ab3c43d947dad96b46a94b81b6a9559 (commit)
via 9d4d2f70cbf83919a11c194c8234de269c5d91ee (commit)
from fdd282afa3e80712790c5bbac84bf4f88644692a (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit a45c5c607ab3c43d947dad96b46a94b81b6a9559
Author: todd stecher <todd.stecher at gmail.com>
Date: Tue Feb 10 12:14:39 2009 -0800
S3: Add in missing full audit entries.
commit 9d4d2f70cbf83919a11c194c8234de269c5d91ee
Author: todd stecher <todd.stecher at gmail.com>
Date: Mon Feb 9 13:25:59 2009 -0800
S3: Fixes for coverity issues.
-----------------------------------------------------------------------
Summary of changes:
source3/auth/pampass.c | 4 +-
source3/lib/smbrun.c | 14 +++++++++---
source3/modules/vfs_full_audit.c | 40 ++++++++++++++++++++++++++++++++-----
source3/utils/net_ads.c | 10 ++++++++-
source3/utils/net_cache.c | 3 +-
source3/utils/ntlm_auth.c | 5 ++-
6 files changed, 60 insertions(+), 16 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 4312b77..4eec269 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -276,7 +276,7 @@ static int smb_pam_passchange_conv(int num_msg,
fstring current_prompt;
fstring current_reply;
struct smb_pam_userdata *udp = (struct smb_pam_userdata *)appdata_ptr;
- struct chat_struct *pw_chat= make_pw_chat(lp_passwd_chat());
+ struct chat_struct *pw_chat;
struct chat_struct *t;
bool found;
*resp = NULL;
@@ -286,7 +286,7 @@ static int smb_pam_passchange_conv(int num_msg,
if (num_msg <= 0)
return PAM_CONV_ERR;
- if (pw_chat == NULL)
+ if ((pw_chat = make_pw_chat(lp_passwd_chat())) == NULL)
return PAM_CONV_ERR;
/*
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index 3199071..fdccd9e 100644
--- a/source3/lib/smbrun.c
+++ b/source3/lib/smbrun.c
@@ -183,11 +183,17 @@ static int smbrun_internal(const char *cmd, int *outfd, bool sanitize)
#endif
{
- const char *newcmd = sanitize ? escape_shell_string(cmd) : cmd;
- if (!newcmd) {
- exit(82);
+ char *newcmd = NULL;
+ if (sanitize) {
+ newcmd = escape_shell_string(cmd);
+ if (!newcmd)
+ exit(82);
}
- execl("/bin/sh","sh","-c",newcmd,NULL);
+
+ execl("/bin/sh","sh","-c",
+ newcmd ? (const char *)newcmd : cmd, NULL);
+
+ SAFE_FREE(newcmd);
}
/* not reached */
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index e7ca77f..faa91c3 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -90,7 +90,7 @@ static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
const char *path,
struct vfs_statvfs_struct *statbuf);
-
+static int smb_full_audit_fs_capabilities(struct vfs_handle_struct *handle);
static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
const char *fname, const char *mask, uint32 attr);
static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle,
@@ -335,11 +335,13 @@ static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct fi
static int smb_full_audit_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
static int smb_full_audit_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
static int smb_full_audit_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts);
+static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle,
+ struct files_struct *fsp);
/* VFS operations */
static vfs_op_tuple audit_op_tuples[] = {
-
+
/* Disk operations */
{SMB_VFS_OP(smb_full_audit_connect), SMB_VFS_OP_CONNECT,
@@ -356,6 +358,8 @@ static vfs_op_tuple audit_op_tuples[] = {
SMB_VFS_LAYER_LOGGER},
{SMB_VFS_OP(smb_full_audit_statvfs), SMB_VFS_OP_STATVFS,
SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_full_audit_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES,
+ SMB_VFS_LAYER_LOGGER},
/* Directory operations */
@@ -520,7 +524,7 @@ static vfs_op_tuple audit_op_tuples[] = {
SMB_VFS_LAYER_LOGGER},
{SMB_VFS_OP(smb_full_audit_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,
SMB_VFS_LAYER_LOGGER},
-
+
/* EA operations. */
{SMB_VFS_OP(smb_full_audit_getxattr), SMB_VFS_OP_GETXATTR,
@@ -547,7 +551,7 @@ static vfs_op_tuple audit_op_tuples[] = {
SMB_VFS_LAYER_LOGGER},
{SMB_VFS_OP(smb_full_audit_fsetxattr), SMB_VFS_OP_FSETXATTR,
SMB_VFS_LAYER_LOGGER},
-
+
{SMB_VFS_OP(smb_full_audit_aio_read), SMB_VFS_OP_AIO_READ,
SMB_VFS_LAYER_LOGGER},
{SMB_VFS_OP(smb_full_audit_aio_write), SMB_VFS_OP_AIO_WRITE,
@@ -562,9 +566,11 @@ static vfs_op_tuple audit_op_tuples[] = {
SMB_VFS_LAYER_LOGGER},
{SMB_VFS_OP(smb_full_audit_aio_suspend),SMB_VFS_OP_AIO_SUSPEND,
SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_full_audit_aio_force),SMB_VFS_OP_AIO_FORCE,
+ SMB_VFS_LAYER_LOGGER},
/* Finish VFS operations definition */
-
+
{SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP,
SMB_VFS_LAYER_NOOP}
};
@@ -682,7 +688,7 @@ static struct {
{ SMB_VFS_OP_IS_OFFLINE, "aio_is_offline" },
{ SMB_VFS_OP_SET_OFFLINE, "aio_set_offline" },
{ SMB_VFS_OP_LAST, NULL }
-};
+};
static int audit_syslog_facility(vfs_handle_struct *handle)
{
@@ -1022,6 +1028,17 @@ static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
return result;
}
+static int smb_full_audit_fs_capabilities(struct vfs_handle_struct *handle)
+{
+ int result;
+
+ result = SMB_VFS_NEXT_FS_CAPABILITIES(handle);
+
+ do_log(SMB_VFS_OP_FS_CAPABILITIES, true, handle, "");
+
+ return result;
+}
+
static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
const char *fname, const char *mask, uint32 attr)
{
@@ -2310,6 +2327,17 @@ static int smb_full_audit_aio_suspend(struct vfs_handle_struct *handle, struct f
return result;
}
+static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle,
+ struct files_struct *fsp)
+{
+ bool result;
+
+ result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
+ do_log(SMB_VFS_OP_AIO_FORCE, result, handle,
+ "%s", fsp->fsp_name);
+
+ return result;
+}
NTSTATUS vfs_full_audit_init(void);
NTSTATUS vfs_full_audit_init(void)
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 86fb9f6..58bbb70 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -123,6 +123,7 @@ static int net_ads_cldap_netlogon(struct net_context *c, ADS_STRUCT *ads)
static int net_ads_lookup(struct net_context *c, int argc, const char **argv)
{
ADS_STRUCT *ads;
+ int ret;
if (c->display_usage) {
d_printf("Usage:\n"
@@ -133,6 +134,7 @@ static int net_ads_lookup(struct net_context *c, int argc, const char **argv)
if (!ADS_ERR_OK(ads_startup_nobind(c, false, &ads))) {
d_fprintf(stderr, "Didn't find the cldap server!\n");
+ ads_destroy(&ads);
return -1;
}
@@ -141,7 +143,9 @@ static int net_ads_lookup(struct net_context *c, int argc, const char **argv)
ads->ldap.port = 389;
}
- return net_ads_cldap_netlogon(c, ads);
+ ret = net_ads_cldap_netlogon(c, ads);
+ ads_destroy(&ads);
+ return ret;
}
@@ -166,6 +170,7 @@ static int net_ads_info(struct net_context *c, int argc, const char **argv)
if (!ads || !ads->config.realm) {
d_fprintf(stderr, "Didn't find the ldap server!\n");
+ ads_destroy(&ads);
return -1;
}
@@ -189,6 +194,7 @@ static int net_ads_info(struct net_context *c, int argc, const char **argv)
d_printf("KDC server: %s\n", ads->auth.kdc_server );
d_printf("Server time offset: %d\n", ads->auth.time_offset );
+ ads_destroy(&ads);
return 0;
}
@@ -383,6 +389,7 @@ static int net_ads_workgroup(struct net_context *c, int argc, const char **argv)
print_sockaddr(addr, sizeof(addr), &ads->ldap.ss);
if ( !ads_cldap_netlogon_5(talloc_tos(), addr, ads->server.realm, &reply ) ) {
d_fprintf(stderr, "CLDAP query failed!\n");
+ ads_destroy(&ads);
return -1;
}
@@ -1847,6 +1854,7 @@ static int net_ads_password(struct net_context *c, int argc, const char **argv)
if (!ads->config.realm) {
d_fprintf(stderr, "Didn't find the kerberos server!\n");
+ ads_destroy(&ads);
return -1;
}
diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c
index cabb6d5..5e7db38 100644
--- a/source3/utils/net_cache.c
+++ b/source3/utils/net_cache.c
@@ -216,7 +216,7 @@ static int net_cache_del(struct net_context *c, int argc, const char **argv)
static int net_cache_get(struct net_context *c, int argc, const char **argv)
{
const char* keystr = argv[0];
- char* valuestr;
+ char* valuestr = NULL;
time_t timeout;
if (argc < 1 || c->display_usage) {
@@ -226,6 +226,7 @@ static int net_cache_get(struct net_context *c, int argc, const char **argv)
if (gencache_get(keystr, &valuestr, &timeout)) {
print_cache_entry(keystr, valuestr, timeout, NULL);
+ SAFE_FREE(valuestr);
return 0;
}
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 8aa8e5e..b94efc9 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -526,7 +526,7 @@ static NTSTATUS winbind_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB
char *error_string;
uint8 lm_key[8];
uint8 user_sess_key[16];
- char *unix_name;
+ char *unix_name = NULL;
nt_status = contact_winbind_auth_crap(ntlmssp_state->user, ntlmssp_state->domain,
ntlmssp_state->workstation,
@@ -549,7 +549,6 @@ static NTSTATUS winbind_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB
}
ntlmssp_state->auth_context = talloc_strdup(ntlmssp_state,
unix_name);
- SAFE_FREE(unix_name);
} else {
DEBUG(NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED) ? 0 : 3,
("Login for user [%s]\\[%s]@[%s] failed due to [%s]\n",
@@ -558,6 +557,8 @@ static NTSTATUS winbind_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB
error_string ? error_string : "unknown error (NULL)"));
ntlmssp_state->auth_context = NULL;
}
+
+ SAFE_FREE(unix_name);
return nt_status;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list