diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-02-24 01:02:45 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-02-24 01:02:45 +0100 |
commit | fff055f8e33a8f0bbb5e7cc5b77d6251bf37e0cf (patch) | |
tree | ba4bb09fa2c79955c247a637cdd20290a249d960 | |
parent | b9cf189404d5ef6b0a2440dc5f9670f0f6d0c131 (diff) | |
parent | 1a9bb33a7db393aff970619f20490e755f0d282b (diff) | |
download | samba-fff055f8e33a8f0bbb5e7cc5b77d6251bf37e0cf.tar.gz samba-fff055f8e33a8f0bbb5e7cc5b77d6251bf37e0cf.tar.bz2 samba-fff055f8e33a8f0bbb5e7cc5b77d6251bf37e0cf.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba
50 files changed, 219 insertions, 1169 deletions
diff --git a/libcli/util/doserr.c b/libcli/util/doserr.c index 160e7bc3e0..226c2f950d 100644 --- a/libcli/util/doserr.c +++ b/libcli/util/doserr.c @@ -135,6 +135,7 @@ static const struct werror_code_struct dos_errs[] = { "WERR_INVALID_FLAGS", WERR_INVALID_FLAGS }, { "WERR_NOT_FOUND", WERR_NOT_FOUND }, { "WERR_SERVER_UNAVAILABLE", WERR_SERVER_UNAVAILABLE }, + { "WERR_INVALID_USER_BUFFER", WERR_INVALID_USER_BUFFER }, { "WERR_NO_TRUST_SAM_ACCOUNT", WERR_NO_TRUST_SAM_ACCOUNT }, { "WERR_CLASS_NOT_REGISTERED", WERR_CLASS_NOT_REGISTERED }, { "WERR_NO_SHUTDOWN_IN_PROGRESS", WERR_NO_SHUTDOWN_IN_PROGRESS }, diff --git a/libcli/util/werror.h b/libcli/util/werror.h index d22516ae5c..4b34b14243 100644 --- a/libcli/util/werror.h +++ b/libcli/util/werror.h @@ -136,6 +136,7 @@ typedef uint32_t WERROR; #define WERR_TIME_SKEW W_ERROR(1398) #define WERR_EVENTLOG_FILE_CORRUPT W_ERROR(1500) #define WERR_SERVER_UNAVAILABLE W_ERROR(1722) +#define WERR_INVALID_USER_BUFFER W_ERROR(1784) #define WERR_NO_TRUST_SAM_ACCOUNT W_ERROR(1787) #define WERR_INVALID_FORM_NAME W_ERROR(1902) #define WERR_INVALID_FORM_SIZE W_ERROR(1903) diff --git a/librpc/ndr/ndr_sec_helper.c b/librpc/ndr/ndr_sec_helper.c index 8f84c02f91..62194707c2 100644 --- a/librpc/ndr/ndr_sec_helper.c +++ b/librpc/ndr/ndr_sec_helper.c @@ -91,14 +91,14 @@ enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, str /* return the wire size of a security_acl */ -size_t ndr_size_security_acl(const struct security_acl *acl, struct smb_iconv_convenience *ic, int flags) +size_t ndr_size_security_acl(const struct security_acl *theacl, struct smb_iconv_convenience *ic, int flags) { size_t ret; int i; - if (!acl) return 0; + if (!theacl) return 0; ret = 8; - for (i=0;i<acl->num_aces;i++) { - ret += ndr_size_security_ace(&acl->aces[i], ic, flags); + for (i=0;i<theacl->num_aces;i++) { + ret += ndr_size_security_ace(&theacl->aces[i], ic, flags); } return ret; } diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 7264ddbcb9..09138cf0aa 100644 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -578,7 +578,7 @@ sub provision_raw_prepare($$$$$$$) push (@provision_options, "NSS_WRAPPER_PASSWD=\"$ctx->{nsswrap_passwd}\""); push (@provision_options, "NSS_WRAPPER_GROUP=\"$ctx->{nsswrap_group}\""); if (defined($ENV{GDB_PROVISION})) { - push (@provision_options, "gdb --args python"); + push (@provision_options, "gdb --args"); } if (defined($ENV{VALGRIND_PROVISION})) { push (@provision_options, "valgrind"); diff --git a/source3/Makefile.in b/source3/Makefile.in index d4a849cbc7..7564659dd3 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -465,7 +465,7 @@ RPC_CLIENT_OBJ1 = rpc_client/cli_netlogon.o LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \ $(RPC_CLIENT_OBJ1) rpc_client/cli_reg.o $(RPC_CLIENT_OBJ) \ - rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o \ + rpc_client/cli_spoolss.o \ rpc_client/init_spoolss.o \ rpc_client/init_samr.o \ librpc/rpc/dcerpc.o \ diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index 8c642b1794..869aeb6a03 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -2677,11 +2677,11 @@ smbc_version(void); */ void -smbc_set_credentials(char *workgroup, - char *user, - char *password, +smbc_set_credentials(const char *workgroup, + const char *user, + const char *password, smbc_bool use_kerberos, - char *signing_state); + const char *signing_state); /* * Wrapper around smbc_set_credentials. diff --git a/source3/include/proto.h b/source3/include/proto.h index 93b4ca8c7d..faf47d3844 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5522,17 +5522,6 @@ WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, TALLOC_CTX *me POLICY_HND *hnd, const char *keyname, uint16 **keylist, uint32 *len); -/* The following definitions come from rpc_client/cli_spoolss_notify.c */ - -WERROR rpccli_spoolss_rrpcn(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint32 notify_data_len, - SPOOL_NOTIFY_INFO_DATA *notify_data, - uint32 change_low, uint32 change_high); -WERROR rpccli_spoolss_rffpcnex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint32 flags, uint32 options, - const char *localmachine, uint32 printerlocal, - SPOOL_NOTIFY_OPTION *option); - /* The following definitions come from rpc_client/init_spoolss.c */ bool init_systemtime(struct spoolss_Time *r, @@ -5817,8 +5806,6 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime); bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime); -bool smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, - prs_struct *ps, int depth); bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u ); bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode); bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, @@ -5835,10 +5822,6 @@ bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, const char *valuename, uint32 size); bool spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth); bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth); -bool spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth); -bool spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth); -bool spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth); -bool spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth); bool smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth); bool smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 *info, int depth); bool smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 *info, int depth); @@ -5994,11 +5977,6 @@ void free_printer_info_5(PRINTER_INFO_5 *printer); void free_printer_info_6(PRINTER_INFO_6 *printer); void free_printer_info_7(PRINTER_INFO_7 *printer); void free_job_info_2(JOB_INFO_2 *job); -bool make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, - uint32 change_low, uint32 change_high, - SPOOL_NOTIFY_INFO *info); -bool spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth); -bool spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth); bool make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, POLICY_HND *hnd, const char *key, uint32 size); @@ -6012,9 +5990,6 @@ bool make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, bool make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, uint32 jobid, uint32 level, RPC_BUFFER *buffer, uint32 offered); -bool make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, - uint32 flags, uint32 options, const char *localmachine, - uint32 printerlocal, SPOOL_NOTIFY_OPTION *option); /* The following definitions come from rpc_server/srv_eventlog_lib.c */ @@ -6140,7 +6115,6 @@ bool convert_devicemode(const char *printername, const DEVICEMODE *devmode, WERROR set_printer_dataex( NT_PRINTER_INFO_LEVEL *printer, const char *key, const char *value, uint32 type, uint8 *data, int real_len ); WERROR _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, SPOOL_R_GETPRINTERDATA *r_u); -WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNEX *r_u); void spoolss_notify_server_name(int snum, struct spoolss_Notify *data, print_queue_struct *queue, @@ -6206,7 +6180,6 @@ void spoolss_notify_cjobs(int snum, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer, TALLOC_CTX *mem_ctx); -WERROR _spoolss_rfnpcnex( pipes_struct *p, SPOOL_Q_RFNPCNEX *q_u, SPOOL_R_RFNPCNEX *r_u); void construct_info_data(struct spoolss_Notify *info_data, enum spoolss_NotifyType type, enum spoolss_Field field, diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 670eca4ca4..504cfea70b 100644 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -343,28 +343,6 @@ PRINTER_DEFAULT; /********************************************/ -typedef struct spool_notify_option_type -{ - uint16 type; - uint16 reserved0; - uint32 reserved1; - uint32 reserved2; - uint32 count; - uint32 fields_ptr; - uint32 count2; - uint16 fields[MAX_NOTIFY_TYPE_FOR_NOW]; -} -SPOOL_NOTIFY_OPTION_TYPE; - -typedef struct spool_notify_option_type_ctr -{ - uint32 count; - SPOOL_NOTIFY_OPTION_TYPE *type; -} -SPOOL_NOTIFY_OPTION_TYPE_CTR; - - - typedef struct s_header_type { uint32 type; @@ -396,86 +374,6 @@ typedef struct spool_r_getprinterdata } SPOOL_R_GETPRINTERDATA; -typedef struct spool_notify_option -{ - uint32 version; - uint32 flags; - uint32 count; - uint32 option_type_ptr; - SPOOL_NOTIFY_OPTION_TYPE_CTR ctr; -} -SPOOL_NOTIFY_OPTION; - -typedef struct spool_notify_info_data -{ - uint16 type; - uint16 field; - uint32 reserved; - uint32 id; - union { - uint32 value[2]; - struct { - uint32 length; - uint16 *string; - } data; - struct { - uint32 size; - SEC_DESC *desc; - } sd; - } - notify_data; - uint32 size; - uint32 enc_type; -} SPOOL_NOTIFY_INFO_DATA; - -typedef struct spool_notify_info -{ - uint32 version; - uint32 flags; - uint32 count; - SPOOL_NOTIFY_INFO_DATA *data; -} -SPOOL_NOTIFY_INFO; - -/* If the struct name looks obscure, yes it is ! */ -/* RemoteFindFirstPrinterChangeNotificationEx query struct */ -typedef struct spoolss_q_rffpcnex -{ - POLICY_HND handle; - uint32 flags; - uint32 options; - uint32 localmachine_ptr; - UNISTR2 localmachine; - uint32 printerlocal; - uint32 option_ptr; - SPOOL_NOTIFY_OPTION *option; -} -SPOOL_Q_RFFPCNEX; - -typedef struct spool_r_rffpcnex -{ - WERROR status; -} -SPOOL_R_RFFPCNEX; - -/* Remote Find Next Printer Change Notify Ex */ -typedef struct spool_q_rfnpcnex -{ - POLICY_HND handle; - uint32 change; - uint32 option_ptr; - SPOOL_NOTIFY_OPTION *option; -} -SPOOL_Q_RFNPCNEX; - -typedef struct spool_r_rfnpcnex -{ - uint32 info_ptr; - SPOOL_NOTIFY_INFO info; - WERROR status; -} -SPOOL_R_RFNPCNEX; - typedef struct printer_info_0 { UNISTR printername; @@ -1349,25 +1247,6 @@ typedef struct spool_r_getjob } SPOOL_R_GETJOB; -typedef struct spool_q_rrpcn -{ - POLICY_HND handle; - uint32 change_low; - uint32 change_high; - uint32 unknown0; - uint32 unknown1; - uint32 info_ptr; - SPOOL_NOTIFY_INFO info; -} -SPOOL_Q_REPLY_RRPCN; - -typedef struct spool_r_rrpcn -{ - uint32 unknown0; - WERROR status; -} -SPOOL_R_REPLY_RRPCN; - typedef struct spool_q_enumprinterkey { POLICY_HND handle; diff --git a/source3/libgpo/gpo_reg.c b/source3/libgpo/gpo_reg.c index 3d385dec14..9367bcae9c 100644 --- a/source3/libgpo/gpo_reg.c +++ b/source3/libgpo/gpo_reg.c @@ -691,7 +691,7 @@ static WERROR gp_reg_generate_sd(TALLOC_CTX *mem_ctx, SEC_ACE ace[6]; uint32_t mask; - SEC_ACL *acl = NULL; + SEC_ACL *theacl = NULL; uint8_t inherit_flags; @@ -735,15 +735,15 @@ static WERROR gp_reg_generate_sd(TALLOC_CTX *mem_ctx, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, inherit_flags); - acl = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 6, ace); - W_ERROR_HAVE_NO_MEMORY(acl); + theacl = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 6, ace); + W_ERROR_HAVE_NO_MEMORY(theacl); *sd = make_sec_desc(mem_ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE | SEC_DESC_DACL_AUTO_INHERITED | /* really ? */ SEC_DESC_DACL_AUTO_INHERIT_REQ, /* really ? */ NULL, NULL, NULL, - acl, sd_size); + theacl, sd_size); W_ERROR_HAVE_NO_MEMORY(*sd); return WERR_OK; diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index c7c9903b76..4c12d18ab7 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -630,11 +630,11 @@ smbc_version(void) * Set the credentials so DFS will work when following referrals. */ void -smbc_set_credentials(char *workgroup, - char *user, - char *password, +smbc_set_credentials(const char *workgroup, + const char *user, + const char *password, smbc_bool use_kerberos, - char *signing_state) + const char *signing_state) { struct user_auth_info *auth_info; @@ -681,18 +681,8 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context, signing_state = "force"; } - /* Using CONST_DISCARD here is ugly, but - * we know that smbc_set_credentials() doesn't - * actually modify the strings, and should have - * been const from the start. We're constrained - * by the ABI here. - */ - - smbc_set_credentials(CONST_DISCARD(char *,workgroup), - CONST_DISCARD(char *,user), - CONST_DISCARD(char *,password), - use_kerberos, - CONST_DISCARD(char *,signing_state)); + smbc_set_credentials(workgroup, user, password, + use_kerberos, signing_state); if (smbc_getOptionFallbackAfterKerberos(context)) { cli_cm_set_fallback_after_kerberos(); diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index ba038479af..7756f8f3ab 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -44,10 +44,10 @@ typedef struct _SMB_ACL4_INT_T SMB_ACE4_INT_T *last; } SMB_ACL4_INT_T; -static SMB_ACL4_INT_T *get_validated_aclint(SMB4ACL_T *acl) +static SMB_ACL4_INT_T *get_validated_aclint(SMB4ACL_T *theacl) { - SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)acl; - if (acl==NULL) + SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)theacl; + if (theacl==NULL) { DEBUG(2, ("acl is NULL\n")); errno = EINVAL; @@ -83,21 +83,21 @@ static SMB_ACE4_INT_T *get_validated_aceint(SMB4ACE_T *ace) SMB4ACL_T *smb_create_smb4acl(void) { TALLOC_CTX *mem_ctx = talloc_tos(); - SMB_ACL4_INT_T *acl = (SMB_ACL4_INT_T *)TALLOC_ZERO_SIZE(mem_ctx, sizeof(SMB_ACL4_INT_T)); - if (acl==NULL) + SMB_ACL4_INT_T *theacl = (SMB_ACL4_INT_T *)TALLOC_ZERO_SIZE(mem_ctx, sizeof(SMB_ACL4_INT_T)); + if (theacl==NULL) { DEBUG(0, ("TALLOC_SIZE failed\n")); errno = ENOMEM; return NULL; } - acl->magic = SMB_ACL4_INT_MAGIC; - /* acl->first, last = NULL not needed */ - return (SMB4ACL_T *)acl; + theacl->magic = SMB_ACL4_INT_MAGIC; + /* theacl->first, last = NULL not needed */ + return (SMB4ACL_T *)theacl; } -SMB4ACE_T *smb_add_ace4(SMB4ACL_T *acl, SMB_ACE4PROP_T *prop) +SMB4ACE_T *smb_add_ace4(SMB4ACL_T *theacl, SMB_ACE4PROP_T *prop) { - SMB_ACL4_INT_T *aclint = get_validated_aclint(acl); + SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); TALLOC_CTX *mem_ctx = talloc_tos(); SMB_ACE4_INT_T *ace; @@ -143,18 +143,18 @@ SMB4ACE_T *smb_next_ace4(SMB4ACE_T *ace) return (SMB4ACE_T *)aceint->next; } -SMB4ACE_T *smb_first_ace4(SMB4ACL_T *acl) +SMB4ACE_T *smb_first_ace4(SMB4ACL_T *theacl) { - SMB_ACL4_INT_T *aclint = get_validated_aclint(acl); + SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); if (aclint==NULL) return NULL; return (SMB4ACE_T *)aclint->first; } -uint32 smb_get_naces(SMB4ACL_T *acl) +uint32 smb_get_naces(SMB4ACL_T *theacl) { - SMB_ACL4_INT_T *aclint = get_validated_aclint(acl); + SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); if (aclint==NULL) return 0; @@ -195,7 +195,7 @@ static int smbacl4_fGetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf) return 0; } -static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */ +static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *theacl, /* in */ DOM_SID *psid_owner, /* in */ DOM_SID *psid_group, /* in */ bool is_directory, /* in */ @@ -203,15 +203,15 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */ int *pgood_aces /* out */ ) { - SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)acl; + SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)theacl; SMB_ACE4_INT_T *aceint; SEC_ACE *nt_ace_list = NULL; int good_aces = 0; DEBUG(10, ("smbacl_nfs42win entered")); - aclint = get_validated_aclint(acl); - /* We do not check for naces being 0 or acl being NULL here because it is done upstream */ + aclint = get_validated_aclint(theacl); + /* We do not check for naces being 0 or theacl being NULL here because it is done upstream */ /* in smb_get_nt_acl_nfs4(). */ nt_ace_list = (SEC_ACE *)TALLOC_ZERO_SIZE(mem_ctx, aclint->naces * sizeof(SEC_ACE)); if (nt_ace_list==NULL) @@ -275,7 +275,7 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */ static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf, uint32 security_info, - SEC_DESC **ppdesc, SMB4ACL_T *acl) + SEC_DESC **ppdesc, SMB4ACL_T *theacl) { int good_aces = 0; DOM_SID sid_owner, sid_group; @@ -284,7 +284,7 @@ static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf, SEC_ACL *psa = NULL; TALLOC_CTX *mem_ctx = talloc_tos(); - if (acl==NULL || smb_get_naces(acl)==0) + if (theacl==NULL || smb_get_naces(theacl)==0) return NT_STATUS_ACCESS_DENIED; /* special because we * shouldn't alloc 0 for * win */ @@ -292,7 +292,7 @@ static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf, uid_to_sid(&sid_owner, sbuf->st_uid); gid_to_sid(&sid_group, sbuf->st_gid); - if (smbacl4_nfs42win(mem_ctx, acl, &sid_owner, &sid_group, S_ISDIR(sbuf->st_mode), + if (smbacl4_nfs42win(mem_ctx, theacl, &sid_owner, &sid_group, S_ISDIR(sbuf->st_mode), &nt_ace_list, &good_aces)==False) { DEBUG(8,("smbacl4_nfs42win failed\n")); return map_nt_error_from_unix(errno); @@ -322,7 +322,7 @@ static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf, NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp, uint32 security_info, - SEC_DESC **ppdesc, SMB4ACL_T *acl) + SEC_DESC **ppdesc, SMB4ACL_T *theacl) { SMB_STRUCT_STAT sbuf; @@ -332,13 +332,13 @@ NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp, return map_nt_error_from_unix(errno); } - return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl); + return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, theacl); } NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn, const char *name, uint32 security_info, - SEC_DESC **ppdesc, SMB4ACL_T *acl) + SEC_DESC **ppdesc, SMB4ACL_T *theacl) { SMB_STRUCT_STAT sbuf; @@ -348,7 +348,7 @@ NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn, return map_nt_error_from_unix(errno); } - return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl); + return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, theacl); } enum smbacl4_mode_enum {e_simple=0, e_special=1}; @@ -399,9 +399,9 @@ static int smbacl4_get_vfs_params( return 0; } -static void smbacl4_dump_nfs4acl(int level, SMB4ACL_T *acl) +static void smbacl4_dump_nfs4acl(int level, SMB4ACL_T *theacl) { - SMB_ACL4_INT_T *aclint = get_validated_aclint(acl); + SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); SMB_ACE4_INT_T *aceint; DEBUG(level, ("NFS4ACL: size=%d\n", aclint->naces)); @@ -423,10 +423,10 @@ static void smbacl4_dump_nfs4acl(int level, SMB4ACL_T *acl) * return ace if found matching; otherwise NULL */ static SMB_ACE4PROP_T *smbacl4_find_equal_special( - SMB4ACL_T *acl, + SMB4ACL_T *theacl, SMB_ACE4PROP_T *aceNew) { - SMB_ACL4_INT_T *aclint = get_validated_aclint(acl); + SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); SMB_ACE4_INT_T *aceint; for(aceint = aclint->first; aceint!=NULL; aceint=(SMB_ACE4_INT_T *)aceint->next) { @@ -618,14 +618,14 @@ static bool smbacl4_fill_ace4( static int smbacl4_MergeIgnoreReject( enum smbacl4_acedup_enum acedup, - SMB4ACL_T *acl, /* may modify it */ + SMB4ACL_T *theacl, /* may modify it */ SMB_ACE4PROP_T *ace, /* the "new" ACE */ bool *paddNewACE, int i ) { int result = 0; - SMB_ACE4PROP_T *ace4found = smbacl4_find_equal_special(acl, ace); + SMB_ACE4PROP_T *ace4found = smbacl4_find_equal_special(theacl, ace); if (ace4found) { switch(acedup) @@ -658,14 +658,14 @@ static SMB4ACL_T *smbacl4_win2nfs4( gid_t ownerGID ) { - SMB4ACL_T *acl; + SMB4ACL_T *theacl; uint32 i; TALLOC_CTX *mem_ctx = talloc_tos(); DEBUG(10, ("smbacl4_win2nfs4 invoked\n")); - acl = smb_create_smb4acl(); - if (acl==NULL) + theacl = smb_create_smb4acl(); + if (theacl==NULL) return NULL; for(i=0; i<dacl->num_aces; i++) { @@ -682,16 +682,16 @@ static SMB4ACL_T *smbacl4_win2nfs4( } if (pparams->acedup!=e_dontcare) { - if (smbacl4_MergeIgnoreReject(pparams->acedup, acl, + if (smbacl4_MergeIgnoreReject(pparams->acedup, theacl, &ace_v4, &addNewACE, i)) return NULL; } if (addNewACE) - smb_add_ace4(acl, &ace_v4); + smb_add_ace4(theacl, &ace_v4); } - return acl; + return theacl; } NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, @@ -700,7 +700,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, set_nfs4acl_native_fn_t set_nfs4_native) { smbacl4_vfs_params params; - SMB4ACL_T *acl = NULL; + SMB4ACL_T *theacl = NULL; bool result; SMB_STRUCT_STAT sbuf; @@ -759,16 +759,16 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, return NT_STATUS_OK; } - acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid); - if (!acl) + theacl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid); + if (!theacl) return map_nt_error_from_unix(errno); - smbacl4_dump_nfs4acl(10, acl); + smbacl4_dump_nfs4acl(10, theacl); if (set_acl_as_root) { become_root(); } - result = set_nfs4_native(fsp, acl); + result = set_nfs4_native(fsp, theacl); saved_errno = errno; if (set_acl_as_root) { unbecome_root(); diff --git a/source3/modules/nfs4_acls.h b/source3/modules/nfs4_acls.h index a227c6e0fc..b2d1196b26 100644 --- a/source3/modules/nfs4_acls.h +++ b/source3/modules/nfs4_acls.h @@ -117,26 +117,26 @@ SMB4ACL_T *smb_create_smb4acl(void); /* prop's contents are copied */ /* it doesn't change the order, appends */ -SMB4ACE_T *smb_add_ace4(SMB4ACL_T *acl, SMB_ACE4PROP_T *prop); +SMB4ACE_T *smb_add_ace4(SMB4ACL_T *theacl, SMB_ACE4PROP_T *prop); SMB_ACE4PROP_T *smb_get_ace4(SMB4ACE_T *ace); /* Returns NULL if none - or error */ -SMB4ACE_T *smb_first_ace4(SMB4ACL_T *acl); +SMB4ACE_T *smb_first_ace4(SMB4ACL_T *theacl); /* Returns NULL in the end - or error */ SMB4ACE_T *smb_next_ace4(SMB4ACE_T *ace); -uint32 smb_get_naces(SMB4ACL_T *acl); +uint32 smb_get_naces(SMB4ACL_T *theacl); NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp, uint32 security_info, - SEC_DESC **ppdesc, SMB4ACL_T *acl); + SEC_DESC **ppdesc, SMB4ACL_T *theacl); NTSTATUS smb_get_nt_acl_nfs4(connection_struct *conn, const char *name, uint32 security_info, - SEC_DESC **ppdesc, SMB4ACL_T *acl); + SEC_DESC **ppdesc, SMB4ACL_T *theacl); /* Callback function needed to set the native acl * when applicable */ diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c index 7bdfe8465b..cafb077555 100644 --- a/source3/modules/vfs_solarisacl.c +++ b/source3/modules/vfs_solarisacl.c @@ -51,11 +51,12 @@ static bool solaris_add_to_acl(SOLARIS_ACL_T *solaris_acl, int *count, static bool solaris_acl_get_file(const char *name, SOLARIS_ACL_T *solarisacl, int *count); static bool solaris_acl_get_fd(int fd, SOLARIS_ACL_T *solarisacl, int *count); -static bool solaris_acl_sort(SOLARIS_ACL_T acl, int count); +static bool solaris_acl_sort(SOLARIS_ACL_T theacl, int count); static SMB_ACL_PERM_T solaris_perm_to_smb_perm(const SOLARIS_PERM_T perm); static SOLARIS_PERM_T smb_perm_to_solaris_perm(const SMB_ACL_PERM_T perm); +#if 0 static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl, int count); - +#endif /* public functions - the api */ @@ -347,7 +348,6 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl, { bool ret = False; int i; - int check_which, check_rc; DEBUG(10, ("entering smb_acl_to_solaris_acl\n")); @@ -717,6 +717,7 @@ static bool solaris_acl_sort(SOLARIS_ACL_T solaris_acl, int count) return True; } +#if 0 /* * acl check function: * unused at the moment but could be used to get more @@ -746,7 +747,7 @@ static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl, int count) } return True; } - +#endif /* VFS operations structure */ diff --git a/source3/registry/reg_dispatcher.c b/source3/registry/reg_dispatcher.c index 7d950c3c4e..c160622054 100644 --- a/source3/registry/reg_dispatcher.c +++ b/source3/registry/reg_dispatcher.c @@ -39,7 +39,7 @@ static WERROR construct_registry_sd(TALLOC_CTX *ctx, SEC_DESC **psd) SEC_ACE ace[3]; size_t i = 0; SEC_DESC *sd; - SEC_ACL *acl; + SEC_ACL *theacl; size_t sd_size; /* basic access for Everyone */ @@ -59,14 +59,14 @@ static WERROR construct_registry_sd(TALLOC_CTX *ctx, SEC_DESC **psd) /* create the security descriptor */ - acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace); - if (acl == NULL) { + theacl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace); + if (theacl == NULL) { return WERR_NOMEM; } sd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, &global_sid_Builtin_Administrators, - &global_sid_System, NULL, acl, + &global_sid_System, NULL, theacl, &sd_size); if (sd == NULL) { return WERR_NOMEM; diff --git a/source3/rpc_client/cli_spoolss_notify.c b/source3/rpc_client/cli_spoolss_notify.c deleted file mode 100644 index 8ae7835c4e..0000000000 --- a/source3/rpc_client/cli_spoolss_notify.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - Unix SMB/CIFS implementation. - RPC pipe client - - Copyright (C) Gerald Carter 2001-2002, - Copyright (C) Tim Potter 2000-2002, - Copyright (C) Andrew Tridgell 1994-2000, - Copyright (C) Jean-Francois Micouleau 1999-2000. - Copyright (C) Jeremy Allison 2005. - - 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/>. -*/ - -#include "includes.h" - -/* - * SPOOLSS Client RPC's used by servers as the notification - * back channel. - */ - -/********************************************************************* - This SPOOLSS_REPLY_RRPCN function is used to send a change - notification event when the registration **did** use - SPOOL_NOTIFY_OPTION_TYPE structure to specify the events to monitor - Also see cli_spoolss_routereplyprinter() - *********************************************************************/ - -WERROR rpccli_spoolss_rrpcn(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint32 notify_data_len, - SPOOL_NOTIFY_INFO_DATA *notify_data, - uint32 change_low, uint32 change_high) -{ - prs_struct qbuf, rbuf; - SPOOL_Q_REPLY_RRPCN q; - SPOOL_R_REPLY_RRPCN r; - WERROR result = W_ERROR(ERRgeneral); - SPOOL_NOTIFY_INFO notify_info; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - ZERO_STRUCT(notify_info); - - /* Initialise input parameters */ - - notify_info.version = 0x2; - notify_info.flags = 0x00020000; /* ?? */ - notify_info.count = notify_data_len; - notify_info.data = notify_data; - - /* create and send a MSRPC command with api */ - /* store the parameters */ - - make_spoolss_q_reply_rrpcn(&q, pol, change_low, change_high, - ¬ify_info); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_RRPCN, - q, r, - qbuf, rbuf, - spoolss_io_q_reply_rrpcn, - spoolss_io_r_reply_rrpcn, - WERR_GENERAL_FAILURE ); - - if (r.unknown0 == 0x00080000) - DEBUG(8,("cli_spoolss_reply_rrpcn: I think the spooler resonded that the notification was ignored.\n")); - else if ( r.unknown0 != 0x0 ) - DEBUG(8,("cli_spoolss_reply_rrpcn: unknown0 is non-zero [0x%x]\n", r.unknown0)); - - result = r.status; - return result; -} - -/********************************************************************* - *********************************************************************/ - -WERROR rpccli_spoolss_rffpcnex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint32 flags, uint32 options, - const char *localmachine, uint32 printerlocal, - SPOOL_NOTIFY_OPTION *option) -{ - prs_struct qbuf, rbuf; - SPOOL_Q_RFFPCNEX q; - SPOOL_R_RFFPCNEX r; - WERROR result = W_ERROR(ERRgeneral); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - make_spoolss_q_rffpcnex( - &q, pol, flags, options, localmachine, printerlocal, - option); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_RFFPCNEX, - q, r, - qbuf, rbuf, - spoolss_io_q_rffpcnex, - spoolss_io_r_rffpcnex, - WERR_GENERAL_FAILURE ); - - result = r.status; - return result; -} diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 577ba73a42..435bb1bd80 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -71,387 +71,6 @@ bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime) } /******************************************************************* -reads or writes an NOTIFY OPTION TYPE structure. -********************************************************************/ - -/* NOTIFY_OPTION_TYPE and NOTIFY_OPTION_TYPE_DATA are really one - structure. The _TYPE structure is really the deferred referrants (i.e - the notify fields array) of the _TYPE structure. -tpot */ - -static bool smb_io_notify_option_type(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_notify_option_type"); - depth++; - - if (!prs_align(ps)) - return False; - - if(!prs_uint16("type", ps, depth, &type->type)) - return False; - if(!prs_uint16("reserved0", ps, depth, &type->reserved0)) - return False; - if(!prs_uint32("reserved1", ps, depth, &type->reserved1)) - return False; - if(!prs_uint32("reserved2", ps, depth, &type->reserved2)) - return False; - if(!prs_uint32("count", ps, depth, &type->count)) - return False; - if(!prs_uint32("fields_ptr", ps, depth, &type->fields_ptr)) - return False; - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY OPTION TYPE DATA. -********************************************************************/ - -static bool smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth) -{ - int i; - - prs_debug(ps, depth, desc, "smb_io_notify_option_type_data"); - depth++; - - /* if there are no fields just return */ - if (type->fields_ptr==0) - return True; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("count2", ps, depth, &type->count2)) - return False; - - if (type->count2 != type->count) - DEBUG(4,("What a mess, count was %x now is %x !\n", type->count, type->count2)); - - if (type->count2 > MAX_NOTIFY_TYPE_FOR_NOW) { - return False; - } - - /* parse the option type data */ - for(i=0;i<type->count2;i++) - if(!prs_uint16("fields",ps,depth,&type->fields[i])) - return False; - return True; -} - -/******************************************************************* -reads or writes an NOTIFY OPTION structure. -********************************************************************/ - -static bool smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth) -{ - int i; - - prs_debug(ps, depth, desc, "smb_io_notify_option_type_ctr"); - depth++; - - if(!prs_uint32("count", ps, depth, &ctr->count)) - return False; - - /* reading */ - if (UNMARSHALLING(ps) && ctr->count) - if((ctr->type=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION_TYPE,ctr->count)) == NULL) - return False; - - /* the option type struct */ - for(i=0;i<ctr->count;i++) - if(!smb_io_notify_option_type("", &ctr->type[i] , ps, depth)) - return False; - - /* the type associated with the option type struct */ - for(i=0;i<ctr->count;i++) - if(!smb_io_notify_option_type_data("", &ctr->type[i] , ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY OPTION structure. -********************************************************************/ - -static bool smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_notify_option"); - depth++; - - if(!prs_uint32("version", ps, depth, &option->version)) - return False; - if(!prs_uint32("flags", ps, depth, &option->flags)) - return False; - if(!prs_uint32("count", ps, depth, &option->count)) - return False; - if(!prs_uint32("option_type_ptr", ps, depth, &option->option_type_ptr)) - return False; - - /* marshalling or unmarshalling, that would work */ - if (option->option_type_ptr!=0) { - if(!smb_io_notify_option_type_ctr("", &option->ctr ,ps, depth)) - return False; - } - else { - option->ctr.type=NULL; - option->ctr.count=0; - } - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY INFO DATA structure. -********************************************************************/ - -static bool smb_io_notify_info_data(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth) -{ - uint32 useless_ptr=0x0FF0ADDE; - - prs_debug(ps, depth, desc, "smb_io_notify_info_data"); - depth++; - - if(!prs_align(ps)) - return False; - if(!prs_uint16("type", ps, depth, &data->type)) - return False; - if(!prs_uint16("field", ps, depth, &data->field)) - return False; - - if(!prs_uint32("how many words", ps, depth, &data->size)) - return False; - if(!prs_uint32("id", ps, depth, &data->id)) - return False; - if(!prs_uint32("how many words", ps, depth, &data->size)) - return False; - - switch (data->enc_type) { - - /* One and two value data has two uint32 values */ - - case NOTIFY_ONE_VALUE: - case NOTIFY_TWO_VALUE: - - if(!prs_uint32("value[0]", ps, depth, &data->notify_data.value[0])) - return False; - if(!prs_uint32("value[1]", ps, depth, &data->notify_data.value[1])) - return False; - break; - - /* Pointers and strings have a string length and a - pointer. For a string the length is expressed as - the number of uint16 characters plus a trailing - \0\0. */ - - case NOTIFY_POINTER: - - if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length )) - return False; - if(!prs_uint32("pointer", ps, depth, &useless_ptr)) - return False; - - break; - - case NOTIFY_STRING: - - if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) - return False; - - if(!prs_uint32("pointer", ps, depth, &useless_ptr)) - return False; - - break; - - case NOTIFY_SECDESC: - if( !prs_uint32( "sd size", ps, depth, &data->notify_data.sd.size ) ) - return False; - if( !prs_uint32( "pointer", ps, depth, &useless_ptr ) ) - return False; - - break; - - default: - DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n", - data->enc_type)); - break; - } - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY INFO DATA structure. -********************************************************************/ - -bool smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings"); - depth++; - - if(!prs_align(ps)) - return False; - - switch(data->enc_type) { - - /* No data for values */ - - case NOTIFY_ONE_VALUE: - case NOTIFY_TWO_VALUE: - - break; - - /* Strings start with a length in uint16s */ - - case NOTIFY_STRING: - - if (MARSHALLING(ps)) - data->notify_data.data.length /= 2; - - if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length)) - return False; - - if (UNMARSHALLING(ps) && data->notify_data.data.length) { - data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, - data->notify_data.data.length); - - if (!data->notify_data.data.string) - return False; - } - - if (!prs_uint16uni(True, "string", ps, depth, data->notify_data.data.string, - data->notify_data.data.length)) - return False; - - if (MARSHALLING(ps)) - data->notify_data.data.length *= 2; - - break; - - case NOTIFY_POINTER: - - if (UNMARSHALLING(ps) && data->notify_data.data.length) { - data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, - data->notify_data.data.length); - - if (!data->notify_data.data.string) - return False; - } - - if(!prs_uint8s(True,"buffer",ps,depth,(uint8*)data->notify_data.data.string,data->notify_data.data.length)) - return False; - - break; - - case NOTIFY_SECDESC: - if( !prs_uint32("secdesc size ", ps, depth, &data->notify_data.sd.size ) ) - return False; - if ( !sec_io_desc( "sec_desc", &data->notify_data.sd.desc, ps, depth ) ) - return False; - break; - - default: - DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n", - data->enc_type)); - break; - } - -#if 0 - if (isvalue==False) { - - /* length of string in unicode include \0 */ - x=data->notify_data.data.length+1; - - if (data->field != 16) - if(!prs_uint32("string length", ps, depth, &x )) - return False; - - if (MARSHALLING(ps)) { - /* These are already in little endian format. Don't byte swap. */ - if (x == 1) { - - /* No memory allocated for this string - therefore following the data.string - pointer is a bad idea. Use a pointer to - the uint32 length union member to - provide a source for a unicode NULL */ - - if(!prs_uint8s(True,"string",ps,depth, (uint8 *)&data->notify_data.data.length,x*2)) - return False; - } else { - - if (data->field == 16) - x /= 2; - - if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) - return False; - } - } else { - - /* Tallocate memory for string */ - - if (x) { - data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, x * 2); - if (!data->notify_data.data.string) - return False; - } else { - data->notify_data.data.string = NULL; - } - - if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x)) - return False; - } - } - -#endif - -#if 0 /* JERRY */ - /* Win2k does not seem to put this parse align here */ - if(!prs_align(ps)) - return False; -#endif - - return True; -} - -/******************************************************************* -reads or writes an NOTIFY INFO structure. -********************************************************************/ - -static bool smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth) -{ - int i; - - prs_debug(ps, depth, desc, "smb_io_notify_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("count", ps, depth, &info->count)) - return False; - if(!prs_uint32("version", ps, depth, &info->version)) - return False; - if(!prs_uint32("flags", ps, depth, &info->flags)) - return False; - if(!prs_uint32("count", ps, depth, &info->count)) - return False; - - for (i=0;i<info->count;i++) { - if(!smb_io_notify_info_data(desc, &info->data[i], ps, depth)) - return False; - } - - /* now do the strings at the end of the stream */ - for (i=0;i<info->count;i++) { - if(!smb_io_notify_info_data_strings(desc, &info->data[i], ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* ********************************************************************/ bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u ) @@ -1014,130 +633,6 @@ bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, } /******************************************************************* - * read a structure. - * called from spoolss_q_rffpcnex (srv_spoolss.c) - ********************************************************************/ - -bool spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) - return False; - if(!prs_uint32("flags", ps, depth, &q_u->flags)) - return False; - if(!prs_uint32("options", ps, depth, &q_u->options)) - return False; - if(!prs_uint32("localmachine_ptr", ps, depth, &q_u->localmachine_ptr)) - return False; - if(!smb_io_unistr2("localmachine", &q_u->localmachine, q_u->localmachine_ptr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("printerlocal", ps, depth, &q_u->printerlocal)) - return False; - - if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr)) - return False; - - if (q_u->option_ptr!=0) { - - if (UNMARSHALLING(ps)) - if((q_u->option=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION,1)) == NULL) - return False; - - if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_rffpcnex (srv_spoolss.c) - ********************************************************************/ - -bool spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex"); - depth++; - - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* - * read a structure. - * called from spoolss_q_rfnpcnex (srv_spoolss.c) - ********************************************************************/ - -bool spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) - return False; - - if(!prs_uint32("change", ps, depth, &q_u->change)) - return False; - - if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr)) - return False; - - if (q_u->option_ptr!=0) { - - if (UNMARSHALLING(ps)) - if((q_u->option=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION,1)) == NULL) - return False; - - if(!smb_io_notify_option("notify option", q_u->option, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* - * write a structure. - * called from spoolss_r_rfnpcnex (srv_spoolss.c) - ********************************************************************/ - -bool spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!prs_uint32("info_ptr", ps, depth, &r_u->info_ptr)) - return False; - - if(!smb_io_notify_info("notify info", &r_u->info ,ps,depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* * return the length of a uint16 (obvious, but the code is clean) ********************************************************************/ @@ -4619,170 +4114,6 @@ void free_job_info_2(JOB_INFO_2 *job) free_devmode(job->devmode); } -#if 0 /* JERRY - not currently used but could be :-) */ - -/******************************************************************* - Deep copy a SPOOL_NOTIFY_INFO_DATA structure - ******************************************************************/ -static bool copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA *dst, - SPOOL_NOTIFY_INFO_DATA *src, int n) -{ - int i; - - memcpy(dst, src, sizeof(SPOOL_NOTIFY_INFO_DATA)*n); - - for (i=0; i<n; i++) { - int len; - uint16 *s = NULL; - - if (src->size != POINTER) - continue; - len = src->notify_data.data.length; - s = SMB_MALLOC_ARRAY(uint16, len); - if (s == NULL) { - DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n")); - return False; - } - - memcpy(s, src->notify_data.data.string, len*2); - dst->notify_data.data.string = s; - } - - return True; -} - -/******************************************************************* - Deep copy a SPOOL_NOTIFY_INFO structure - ******************************************************************/ -static bool copy_spool_notify_info(SPOOL_NOTIFY_INFO *dst, SPOOL_NOTIFY_INFO *src) -{ - if (!dst) { - DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n")); - return False; - } - - dst->version = src->version; - dst->flags = src->flags; - dst->count = src->count; - - if (dst->count) - { - dst->data = SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA, dst->count); - - DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n", - dst->count)); - - if (dst->data == NULL) { - DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n", - dst->count)); - return False; - } - - return (copy_spool_notify_info_data(dst->data, src->data, src->count)); - } - - return True; -} -#endif /* JERRY */ - -/******************************************************************* - * init a structure. - ********************************************************************/ - -bool make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, - uint32 change_low, uint32 change_high, - SPOOL_NOTIFY_INFO *info) -{ - if (q_u == NULL) - return False; - - memcpy(&q_u->handle, hnd, sizeof(q_u->handle)); - - q_u->change_low=change_low; - q_u->change_high=change_high; - - q_u->unknown0=0x0; - q_u->unknown1=0x0; - - q_u->info_ptr=0x0FF0ADDE; - - q_u->info.version=2; - - if (info->count) { - DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n", - info->count)); - q_u->info.version = info->version; - q_u->info.flags = info->flags; - q_u->info.count = info->count; - /* pointer field - be careful! */ - q_u->info.data = info->data; - } - else { - q_u->info.flags=PRINTER_NOTIFY_INFO_DISCARDED; - q_u->info.count=0; - } - - return True; -} - -/******************************************************************* - Parse a SPOOL_Q_REPLY_RRPCN structure. -********************************************************************/ - -bool spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_q_reply_rrpcn"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) - return False; - - if (!prs_uint32("change_low", ps, depth, &q_u->change_low)) - return False; - - if (!prs_uint32("change_high", ps, depth, &q_u->change_high)) - return False; - - if (!prs_uint32("unknown0", ps, depth, &q_u->unknown0)) - return False; - - if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1)) - return False; - - if (!prs_uint32("info_ptr", ps, depth, &q_u->info_ptr)) - return False; - - if(q_u->info_ptr!=0) - if(!smb_io_notify_info(desc, &q_u->info, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Parse a SPOOL_R_REPLY_RRPCN structure. -********************************************************************/ - -bool spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "spoolss_io_r_reply_rrpcn"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("unknown0", ps, depth, &r_u->unknown0)) - return False; - - if (!prs_werror("status", ps, depth, &r_u->status)) - return False; - - return True; -} - /******************************************************************* * read a structure. ********************************************************************/ @@ -5071,30 +4402,3 @@ bool make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, return True; } - -/******************************************************************* - * init a structure. - ********************************************************************/ - -bool make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, - uint32 flags, uint32 options, const char *localmachine, - uint32 printerlocal, SPOOL_NOTIFY_OPTION *option) -{ - memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); - - q_u->flags = flags; - q_u->options = options; - - q_u->localmachine_ptr = 1; - - init_unistr2(&q_u->localmachine, localmachine, UNI_STR_TERMINATE); - - q_u->printerlocal = printerlocal; - - if (option) - q_u->option_ptr = 1; - - q_u->option = option; - - return True; -} diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c index 33bf3d0098..b90a189f7e 100644 --- a/source3/rpc_server/srv_svcctl_nt.c +++ b/source3/rpc_server/srv_svcctl_nt.c @@ -139,7 +139,7 @@ static SEC_DESC* construct_scm_sd( TALLOC_CTX *ctx ) SEC_ACE ace[2]; size_t i = 0; SEC_DESC *sd; - SEC_ACL *acl; + SEC_ACL *theacl; size_t sd_size; /* basic access for Everyone */ @@ -155,12 +155,12 @@ static SEC_DESC* construct_scm_sd( TALLOC_CTX *ctx ) /* create the security descriptor */ - if ( !(acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) ) + if ( !(theacl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) ) return NULL; if ( !(sd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, - acl, &sd_size)) ) + theacl, &sd_size)) ) return NULL; return sd; diff --git a/source3/services/services_db.c b/source3/services/services_db.c index 6d1b5d5b95..ef975cfbc4 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -91,7 +91,7 @@ static SEC_DESC* construct_service_sd( TALLOC_CTX *ctx ) SEC_ACE ace[4]; size_t i = 0; SEC_DESC *sd = NULL; - SEC_ACL *acl = NULL; + SEC_ACL *theacl = NULL; size_t sd_size; /* basic access for Everyone */ @@ -109,12 +109,12 @@ static SEC_DESC* construct_service_sd( TALLOC_CTX *ctx ) /* create the security descriptor */ - if ( !(acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) ) + if ( !(theacl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) ) return NULL; if ( !(sd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, - acl, &sd_size)) ) + theacl, &sd_size)) ) return NULL; return sd; diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c index 5dd788ad5f..bbbaaf089f 100644 --- a/source3/utils/profiles.c +++ b/source3/utils/profiles.c @@ -57,7 +57,7 @@ static void verbose_output(const char *format, ...) static bool swap_sid_in_acl( SEC_DESC *sd, DOM_SID *s1, DOM_SID *s2 ) { - SEC_ACL *acl; + SEC_ACL *theacl; int i; bool update = False; @@ -78,30 +78,30 @@ static bool swap_sid_in_acl( SEC_DESC *sd, DOM_SID *s1, DOM_SID *s2 ) sid_string_tos(sd->group_sid)); } - acl = sd->dacl; - verbose_output(" DACL: %d entries:\n", acl->num_aces); - for ( i=0; i<acl->num_aces; i++ ) { + theacl = sd->dacl; + verbose_output(" DACL: %d entries:\n", theacl->num_aces); + for ( i=0; i<theacl->num_aces; i++ ) { verbose_output(" Trustee SID: %s\n", - sid_string_tos(&acl->aces[i].trustee)); - if ( sid_equal( &acl->aces[i].trustee, s1 ) ) { - sid_copy( &acl->aces[i].trustee, s2 ); + sid_string_tos(&theacl->aces[i].trustee)); + if ( sid_equal( &theacl->aces[i].trustee, s1 ) ) { + sid_copy( &theacl->aces[i].trustee, s2 ); update = True; verbose_output(" New Trustee SID: %s\n", - sid_string_tos(&acl->aces[i].trustee)); + sid_string_tos(&theacl->aces[i].trustee)); } } #if 0 - acl = sd->sacl; - verbose_output(" SACL: %d entries: \n", acl->num_aces); - for ( i=0; i<acl->num_aces; i++ ) { + theacl = sd->sacl; + verbose_output(" SACL: %d entries: \n", theacl->num_aces); + for ( i=0; i<theacl->num_aces; i++ ) { verbose_output(" Trustee SID: %s\n", - sid_string_tos(&acl->aces[i].trustee)); - if ( sid_equal( &acl->aces[i].trustee, s1 ) ) { - sid_copy( &acl->aces[i].trustee, s2 ); + sid_string_tos(&theacl->aces[i].trustee)); + if ( sid_equal( &theacl->aces[i].trustee, s1 ) ) { + sid_copy( &theacl->aces[i].trustee, s2 ); update = True; verbose_output(" New Trustee SID: %s\n", - sid_string_tos(&acl->aces[i].trustee)); + sid_string_tos(&theacl->aces[i].trustee)); } } #endif diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c index ae2a9adf64..4be77ecadd 100644 --- a/source3/utils/sharesec.c +++ b/source3/utils/sharesec.c @@ -298,7 +298,7 @@ static SEC_DESC* parse_acl_string(TALLOC_CTX *mem_ctx, const char *szACL, size_t { SEC_DESC *sd = NULL; SEC_ACE *ace; - SEC_ACL *acl; + SEC_ACL *theacl; int num_ace; const char *pacl; int i; @@ -326,11 +326,11 @@ static SEC_DESC* parse_acl_string(TALLOC_CTX *mem_ctx, const char *szACL, size_t pacl++; } - if ( !(acl = make_sec_acl( mem_ctx, NT4_ACL_REVISION, num_ace, ace )) ) + if ( !(theacl = make_sec_acl( mem_ctx, NT4_ACL_REVISION, num_ace, ace )) ) return NULL; sd = make_sec_desc( mem_ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, - NULL, NULL, NULL, acl, sd_size); + NULL, NULL, NULL, theacl, sd_size); return sd; } diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk index 01f5188b6f..583d1dcf04 100644 --- a/source4/dsdb/samdb/ldb_modules/config.mk +++ b/source4/dsdb/samdb/ldb_modules/config.mk @@ -89,7 +89,7 @@ ldb_samldb_OBJ_FILES = \ [MODULE::ldb_samba3sam] SUBSYSTEM = LIBLDB INIT_FUNCTION = LDB_MODULE(samba3sam) -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS SMBPASSWD \ +PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBLDB SMBPASSWD \ NSS_WRAPPER LIBSECURITY NDR_SECURITY # End MODULE ldb_samldb ################################################ @@ -102,7 +102,7 @@ ldb_samba3sam_OBJ_FILES = \ [MODULE::ldb_simple_ldap_map] SUBSYSTEM = LIBLDB INIT_FUNCTION = LDB_MODULE(entryuuid),LDB_MODULE(nsuniqueid) -PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBNDR +PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBLDB LIBNDR ENABLE = YES ALIASES = entryuuid nsuniqueid # End MODULE ldb_entryuuid diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c index 2365a58f78..4e28c8a149 100644 --- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c +++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c @@ -30,6 +30,7 @@ #include "includes.h" #include "ldb_module.h" +#include "dlinklist.h" #include "dsdb/samdb/samdb.h" struct la_op_store { diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c index 0261bb32e9..898d913965 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass.c @@ -35,6 +35,7 @@ #include "includes.h" #include "ldb_module.h" +#include "dlinklist.h" #include "dsdb/samdb/samdb.h" #include "librpc/ndr/libndr.h" #include "librpc/gen_ndr/ndr_security.h" diff --git a/source4/dsdb/samdb/ldb_modules/ranged_results.c b/source4/dsdb/samdb/ldb_modules/ranged_results.c index 8f36baa7d6..5ce69a26a2 100644 --- a/source4/dsdb/samdb/ldb_modules/ranged_results.c +++ b/source4/dsdb/samdb/ldb_modules/ranged_results.c @@ -29,6 +29,7 @@ * Author: Andrew Bartlett */ +#include "includes.h" #include "ldb_module.h" struct rr_context { diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c index 3f10748085..59cb9de717 100644 --- a/source4/dsdb/samdb/ldb_modules/samba3sam.c +++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c @@ -6,7 +6,7 @@ */ #include "includes.h" -#include "ldb/include/ldb_module.h" +#include "ldb_module.h" #include "ldb/ldb_map/ldb_map.h" #include "system/passwd.h" diff --git a/source4/dsdb/samdb/ldb_modules/update_keytab.c b/source4/dsdb/samdb/ldb_modules/update_keytab.c index 8920afee71..f1b6863cdb 100644 --- a/source4/dsdb/samdb/ldb_modules/update_keytab.c +++ b/source4/dsdb/samdb/ldb_modules/update_keytab.c @@ -29,6 +29,7 @@ #include "includes.h" #include "ldb_module.h" +#include "dlinklist.h" #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_krb5.h" #include "system/kerberos.h" diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index d6b3e40e1a..6abd8a8f88 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "dlinklist.h" #include "dsdb/samdb/samdb.h" #include "lib/ldb/include/ldb_module.h" #include "param/param.h" diff --git a/source4/lib/ldb/Makefile.in b/source4/lib/ldb/Makefile.in index 7f00e8ebee..663dea9f80 100644 --- a/source4/lib/ldb/Makefile.in +++ b/source4/lib/ldb/Makefile.in @@ -67,7 +67,7 @@ MDLD_FLAGS = @MDLD_FLAGS@ OBJS = $(MODULES_OBJ) $(COMMON_OBJ) $(LDB_TDB_OBJ) $(TDB_OBJ) $(TEVENT_OBJ) $(TALLOC_OBJ) $(POPT_OBJ) $(LDB_MAP_OBJ) @LIBREPLACEOBJ@ $(EXTRA_OBJ) -headers = $(srcdir)/include/ldb.h $(srcdir)/include/ldb_errors.h $(srcdir)/include/ldb_handlers.h $(srcdir)/include/ldb_includes.h $(srcdir)/include/ldb_module.h +headers = $(srcdir)/include/ldb.h $(srcdir)/include/ldb_errors.h $(srcdir)/include/ldb_handlers.h $(srcdir)/include/ldb_module.h BINS = bin/ldbadd bin/ldbsearch bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbrename bin/ldbtest diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 2fb5a8f9be..f1b28b6819 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -34,6 +34,19 @@ #include "ldb_private.h" +static int ldb_context_destructor(void *ptr) +{ + struct ldb_context *ldb = talloc_get_type(ptr, struct ldb_context); + + if (ldb->transaction_active) { + ldb_debug(ldb, LDB_DEBUG_FATAL, + "A transaction is still active in ldb context [%p]", + ldb); + } + + return 0; +} + /* initialise a ldb context The mem_ctx is required @@ -65,6 +78,8 @@ struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx) /* TODO: get timeout from options if available there */ ldb->default_timeout = 300; /* set default to 5 minutes */ + talloc_set_destructor((TALLOC_CTX *)ldb, ldb_context_destructor); + return ldb; } @@ -242,10 +257,24 @@ void ldb_reset_err_string(struct ldb_context *ldb) /* start a transaction */ -static int ldb_transaction_start_internal(struct ldb_context *ldb) +int ldb_transaction_start(struct ldb_context *ldb) { struct ldb_module *module; int status; + + ldb_debug(ldb, LDB_DEBUG_TRACE, + "start ldb transaction (nesting: %d)", + ldb->transaction_active); + + /* explicit transaction active, count nested requests */ + if (ldb->transaction_active) { + ldb->transaction_active++; + return LDB_SUCCESS; + } + + /* start a new transaction */ + ldb->transaction_active++; + FIRST_OP(ldb, start_transaction); ldb_reset_err_string(ldb); @@ -266,10 +295,29 @@ static int ldb_transaction_start_internal(struct ldb_context *ldb) /* commit a transaction */ -static int ldb_transaction_commit_internal(struct ldb_context *ldb) +int ldb_transaction_commit(struct ldb_context *ldb) { struct ldb_module *module; int status; + + ldb->transaction_active--; + + ldb_debug(ldb, LDB_DEBUG_TRACE, + "commit ldb transaction (nesting: %d)", + ldb->transaction_active); + + /* commit only when all nested transactions are complete */ + if (ldb->transaction_active > 0) { + return LDB_SUCCESS; + } + + if (ldb->transaction_active < 0) { + ldb_debug(ldb, LDB_DEBUG_FATAL, + "commit called but no ldb transactions are active!"); + ldb->transaction_active = 0; + return LDB_ERR_OPERATIONS_ERROR; + } + FIRST_OP(ldb, end_transaction); ldb_reset_err_string(ldb); @@ -290,10 +338,29 @@ static int ldb_transaction_commit_internal(struct ldb_context *ldb) /* cancel a transaction */ -static int ldb_transaction_cancel_internal(struct ldb_context *ldb) +int ldb_transaction_cancel(struct ldb_context *ldb) { struct ldb_module *module; int status; + + ldb->transaction_active--; + + ldb_debug(ldb, LDB_DEBUG_TRACE, + "cancel ldb transaction (nesting: %d)", + ldb->transaction_active); + + /* really cancel only if all nested transactions are complete */ + if (ldb->transaction_active > 0) { + return LDB_SUCCESS; + } + + if (ldb->transaction_active < 0) { + ldb_debug(ldb, LDB_DEBUG_FATAL, + "commit called but no ldb transactions are active!"); + ldb->transaction_active = 0; + return LDB_ERR_OPERATIONS_ERROR; + } + FIRST_OP(ldb, del_transaction); status = module->ops->del_transaction(module); @@ -309,66 +376,13 @@ static int ldb_transaction_cancel_internal(struct ldb_context *ldb) return status; } -int ldb_transaction_start(struct ldb_context *ldb) -{ - /* disable autotransactions */ - ldb->transaction_active++; - - return ldb_transaction_start_internal(ldb); -} - -int ldb_transaction_commit(struct ldb_context *ldb) -{ - /* renable autotransactions (when we reach 0) */ - if (ldb->transaction_active > 0) - ldb->transaction_active--; - - return ldb_transaction_commit_internal(ldb); -} - -int ldb_transaction_cancel(struct ldb_context *ldb) -{ - /* renable autotransactions (when we reach 0) */ - if (ldb->transaction_active > 0) - ldb->transaction_active--; - - return ldb_transaction_cancel_internal(ldb); -} - -static int ldb_autotransaction_start(struct ldb_context *ldb) -{ - /* explicit transaction active, ignore autotransaction request */ - if (ldb->transaction_active) - return LDB_SUCCESS; - - return ldb_transaction_start_internal(ldb); -} - -static int ldb_autotransaction_commit(struct ldb_context *ldb) -{ - /* explicit transaction active, ignore autotransaction request */ - if (ldb->transaction_active) - return LDB_SUCCESS; - - return ldb_transaction_commit_internal(ldb); -} - -static int ldb_autotransaction_cancel(struct ldb_context *ldb) -{ - /* explicit transaction active, ignore autotransaction request */ - if (ldb->transaction_active) - return LDB_SUCCESS; - - return ldb_transaction_cancel_internal(ldb); -} - /* autostarts a transacion if none active */ static int ldb_autotransaction_request(struct ldb_context *ldb, struct ldb_request *req) { int ret; - ret = ldb_autotransaction_start(ldb); + ret = ldb_transaction_start(ldb); if (ret != LDB_SUCCESS) { return ret; } @@ -379,9 +393,9 @@ static int ldb_autotransaction_request(struct ldb_context *ldb, } if (ret == LDB_SUCCESS) { - return ldb_autotransaction_commit(ldb); + return ldb_transaction_commit(ldb); } - ldb_autotransaction_cancel(ldb); + ldb_transaction_cancel(ldb); if (ldb->err_string == NULL) { /* no error string was setup by the backend */ diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 99a47767e1..ae97ef4cce 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -32,10 +32,7 @@ */ #include "ldb_private.h" - -#if (_SAMBA_BUILD_ >= 4) -#include "includes.h" -#endif +#include "dlinklist.h" #define LDB_MODULE_PREFIX "modules:" #define LDB_MODULE_PREFIX_LEN 8 diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 6990397a74..eb8e0ed11e 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -46,7 +46,19 @@ #define _LDB_H_ 1 /*! \endcond */ -#include "ldb_includes.h" +#ifndef bool +typedef int bool; +#endif +#ifndef true +#define true 1 +#endif +#ifndef false +#define false 0 +#endif + +#include "talloc.h" +#include "tevent.h" +#include "ldb_errors.h" /* major restrictions as compared to normal LDAP: diff --git a/source4/lib/ldb/include/ldb_includes.h b/source4/lib/ldb/include/ldb_includes.h index a2927139c8..602bbec32c 100644 --- a/source4/lib/ldb/include/ldb_includes.h +++ b/source4/lib/ldb/include/ldb_includes.h @@ -4,11 +4,6 @@ a temporary includes file until I work on the ldb build system */ -#if (_SAMBA_BUILD_ >= 4) -/* tell ldb we have the internal ldap code */ -#define HAVE_ILDAP 1 -#endif - #if (_SAMBA_BUILD_ <= 3) /* allow forbidden string functions - should be replaced with _m functions */ #undef strcasecmp @@ -19,9 +14,5 @@ #include "replace.h" #include "system/filesys.h" #include "system/time.h" -#include <talloc.h> -#include <tevent.h> -#include "ldb_errors.h" -#include "dlinklist.h" #endif /*_LDB_PRIVATE_INCLUDES_H_*/ diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index 1ce9e9ecfd..2e8da9941c 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -37,6 +37,7 @@ #ifndef _LDB_PRIVATE_H_ #define _LDB_PRIVATE_H_ 1 +#include "ldb_includes.h" #include "ldb.h" #include "ldb_module.h" @@ -109,10 +110,6 @@ struct ldb_context { struct tevent_context *ev_ctx; }; -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) -#endif - /* The following definitions come from lib/ldb/common/ldb.c */ int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *options[], diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index b134405048..4447d0e09a 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -40,11 +40,10 @@ * author: Simo Sorce */ - #include "includes.h" #include "ldb_module.h" +#include "dlinklist.h" -#include "tevent.h" #include "libcli/ldap/ldap.h" #include "libcli/ldap/ldap_client.h" #include "auth/auth.h" diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index e1fcdb1353..43a01f75a7 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -38,6 +38,7 @@ * author: Simo Sorce */ +#include "ldb_includes.h" #include "ldb_module.h" #define LDAP_DEPRECATED 1 diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index ea2bfd1dc1..959540374c 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.c +++ b/source4/lib/ldb/ldb_map/ldb_map.c @@ -35,8 +35,6 @@ * Author: Jelmer Vernooij, Martin Kuehl */ -#include "ldb_module.h" - #include "ldb_map.h" #include "ldb_map_private.h" diff --git a/source4/lib/ldb/ldb_map/ldb_map.h b/source4/lib/ldb/ldb_map/ldb_map.h index 872208174e..3c1fe80895 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.h +++ b/source4/lib/ldb/ldb_map/ldb_map.h @@ -26,6 +26,8 @@ #ifndef __LDB_MAP_H__ #define __LDB_MAP_H__ +#include "ldb_module.h" + /* ldb_map is a skeleton LDB module that can be used for any other modules * that need to map attributes. * diff --git a/source4/lib/ldb/ldb_map/ldb_map_inbound.c b/source4/lib/ldb/ldb_map/ldb_map_inbound.c index e915a5f46a..822dea654e 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_inbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_inbound.c @@ -24,8 +24,6 @@ */ -#include "ldb_module.h" - #include "ldb_map.h" #include "ldb_map_private.h" diff --git a/source4/lib/ldb/ldb_map/ldb_map_outbound.c b/source4/lib/ldb/ldb_map/ldb_map_outbound.c index 327fa92f8d..eb7b4590ba 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_outbound.c @@ -25,8 +25,6 @@ */ -#include "ldb_module.h" - #include "ldb_map.h" #include "ldb_map_private.h" diff --git a/source4/lib/ldb/ldb_map/ldb_map_private.h b/source4/lib/ldb/ldb_map/ldb_map_private.h index 0c46443253..612d215ae9 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_private.h +++ b/source4/lib/ldb/ldb_map/ldb_map_private.h @@ -1,3 +1,4 @@ +#include "ldb_includes.h" /* A handy macro to report Out of Memory conditions */ #define map_oom(module) ldb_set_errstring(ldb_module_get_ctx(module), talloc_asprintf(module, "Out of Memory")); diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index cdbef3944b..ad27c9a9a9 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -32,6 +32,7 @@ */ #include "ldb_tdb.h" +#include "dlinklist.h" /* the idxptr code is a bit unusual. The way it works is to replace diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index d6276c4b86..24ec06ea32 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -865,6 +865,7 @@ static int ltdb_end_trans(struct ldb_module *module) ltdb->in_transaction--; if (ltdb_index_transaction_commit(module) != 0) { + tdb_transaction_cancel(ltdb->tdb); return ltdb_err_map(tdb_error(ltdb->tdb)); } @@ -883,6 +884,7 @@ static int ltdb_del_trans(struct ldb_module *module) ltdb->in_transaction--; if (ltdb_index_transaction_cancel(module) != 0) { + tdb_transaction_cancel(ltdb->tdb); return ltdb_err_map(tdb_error(ltdb->tdb)); } diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h index 7ebf199f6f..0a06cdb1b0 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h @@ -1,11 +1,5 @@ -#if (_SAMBA_BUILD_ == 3) -#include "tdb/include/tdb.h" -#else -#include "replace.h" -#include "system/wait.h" +#include "ldb_includes.h" #include "tdb.h" -#endif - #include "ldb_module.h" /* this private structure is used by the ltdb backend in the diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c index d862638389..43b223b52e 100644 --- a/source4/lib/ldb/modules/operational.c +++ b/source4/lib/ldb/modules/operational.c @@ -73,8 +73,13 @@ modifiersName: not supported by w2k3? */ +#include "ldb_includes.h" #include "ldb_module.h" +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) +#endif + /* construct a canonical name from a message */ diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index 7d7cdf66a0..2a06c5e6c5 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -32,6 +32,7 @@ * Author: Simo Sorce */ +#include "ldb_includes.h" #include "ldb_module.h" struct message_store { diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index a5ffcc034a..880678d89d 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -36,6 +36,7 @@ * Simo Sorce Mar 2006 */ +#include "ldb_includes.h" #include "ldb_module.h" struct rename_context { diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c index 3dce9b187b..2701de5a48 100644 --- a/source4/lib/ldb/tools/cmdline.c +++ b/source4/lib/ldb/tools/cmdline.c @@ -21,6 +21,7 @@ License along with this library; if not, see <http://www.gnu.org/licenses/>. */ +#include "ldb_includes.h" #include "ldb.h" #include "tools/cmdline.h" diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index 3a915f8bea..9d3bd27983 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -30,7 +30,7 @@ * * Author: Andrew Tridgell */ - +#include "ldb_includes.h" #include "ldb.h" #include "tools/cmdline.h" diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 35d4ac7002..ba0a2a8927 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -31,6 +31,7 @@ * Author: Andrew Tridgell */ +#include "ldb_includes.h" #include "ldb.h" #include "tools/cmdline.h" diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index edaa9fb85c..6af0ee9336 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -31,6 +31,7 @@ * Author: Andrew Tridgell */ +#include "ldb_includes.h" #include "ldb.h" #include "tools/cmdline.h" |