From e6ec32f3acbf626f7cf52fc516f9b496d4e1d6f6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 1 Mar 2009 04:59:07 +0100 Subject: Eliminate two duplicate SEC_ACE_TYPE constants already provided by security.idl. --- source3/include/rpc_secdes.h | 3 --- source3/lib/display_sec.c | 8 ++++---- source3/libads/disp_sec.c | 8 ++++---- source3/libgpo/gpo_sec.c | 4 ++-- source3/rpc_parse/parse_sec.c | 4 ++-- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/source3/include/rpc_secdes.h b/source3/include/rpc_secdes.h index a1cfad9003..4bf0d9cb9d 100644 --- a/source3/include/rpc_secdes.h +++ b/source3/include/rpc_secdes.h @@ -39,9 +39,6 @@ #define SEC_RIGHTS_RESET_PASSWD SEC_RIGHTS_EXTENDED #define SEC_RIGHTS_FULL_CTRL 0xf01ff -#define SEC_ACE_OBJECT_PRESENT 0x00000001 /* thanks for Jim McDonough */ -#define SEC_ACE_OBJECT_INHERITED_PRESENT 0x00000002 - /* * New Windows 2000 bits. */ diff --git a/source3/lib/display_sec.c b/source3/lib/display_sec.c index 636639c11d..fe1ae77edd 100644 --- a/source3/lib/display_sec.c +++ b/source3/lib/display_sec.c @@ -155,13 +155,13 @@ void display_sec_ace_flags(uint8_t flags) ****************************************************************************/ static void disp_sec_ace_object(struct security_ace_object *object) { - if (object->flags & SEC_ACE_OBJECT_PRESENT) { - printf("Object type: SEC_ACE_OBJECT_PRESENT\n"); + if (object->flags & SEC_ACE_OBJECT_TYPE_PRESENT) { + printf("Object type: SEC_ACE_OBJECT_TYPE_PRESENT\n"); printf("Object GUID: %s\n", GUID_string(talloc_tos(), &object->type.type)); } - if (object->flags & SEC_ACE_OBJECT_INHERITED_PRESENT) { - printf("Object type: SEC_ACE_OBJECT_INHERITED_PRESENT\n"); + if (object->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT) { + printf("Object type: SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT\n"); printf("Object GUID: %s\n", GUID_string(talloc_tos(), &object->inherited_type.inherited_type)); } diff --git a/source3/libads/disp_sec.c b/source3/libads/disp_sec.c index a5e04a4a6c..3bf0b6f7a7 100644 --- a/source3/libads/disp_sec.c +++ b/source3/libads/disp_sec.c @@ -112,15 +112,15 @@ static void ads_disp_sec_ace_object(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct security_ace_object *object) { - if (object->flags & SEC_ACE_OBJECT_PRESENT) { - printf("Object type: SEC_ACE_OBJECT_PRESENT\n"); + if (object->flags & SEC_ACE_OBJECT_TYPE_PRESENT) { + printf("Object type: SEC_ACE_OBJECT_TYPE_PRESENT\n"); printf("Object GUID: %s (%s)\n", GUID_string(mem_ctx, &object->type.type), ads_interprete_guid_from_object(ads, mem_ctx, &object->type.type)); } - if (object->flags & SEC_ACE_OBJECT_INHERITED_PRESENT) { - printf("Object type: SEC_ACE_OBJECT_INHERITED_PRESENT\n"); + if (object->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT) { + printf("Object type: SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT\n"); printf("Object GUID: %s (%s)\n", GUID_string(mem_ctx, &object->inherited_type.inherited_type), ads_interprete_guid_from_object(ads, mem_ctx, diff --git a/source3/libgpo/gpo_sec.c b/source3/libgpo/gpo_sec.c index 42ab72a99b..c72bb26732 100644 --- a/source3/libgpo/gpo_sec.c +++ b/source3/libgpo/gpo_sec.c @@ -38,12 +38,12 @@ static bool gpo_sd_check_agp_object_guid(const struct security_ace_object *objec } switch (object->flags) { - case SEC_ACE_OBJECT_PRESENT: + case SEC_ACE_OBJECT_TYPE_PRESENT: if (GUID_equal(&object->type.type, &ext_right_apg_guid)) { return True; } - case SEC_ACE_OBJECT_INHERITED_PRESENT: + case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: if (GUID_equal(&object->inherited_type.inherited_type, &ext_right_apg_guid)) { return True; diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 23c9610381..91d8591a05 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -73,11 +73,11 @@ static bool sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, if (!prs_uint32("obj_flags", ps, depth, &psa->object.object.flags)) return False; - if (psa->object.object.flags & SEC_ACE_OBJECT_PRESENT) + if (psa->object.object.flags & SEC_ACE_OBJECT_TYPE_PRESENT) if (!smb_io_uuid("obj_guid", &psa->object.object.type.type, ps,depth)) return False; - if (psa->object.object.flags & SEC_ACE_OBJECT_INHERITED_PRESENT) + if (psa->object.object.flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT) if (!smb_io_uuid("inh_guid", &psa->object.object.inherited_type.inherited_type, ps,depth)) return False; -- cgit From 4a35c974e97551b1ccbfa41d4c08f0598e3c26aa Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 1 Mar 2009 11:39:44 +0100 Subject: Only copy sharename up from rap_to_pjobid Why?? :-) Another one of the little micro-optimizations that I just came across: If you allocate a variable in a sub-block like the "fstring sharename" in write_file(), gcc even with -O3 will allocate this variable unconditionally on the stack at the beginning of the routine. So with eliminating this fstring we cut 256 bytes of stack in a very hot code path writing to a file. It might make us a bit more cache-friendly. This would probably not be worth a second look if it involved larger code changes, but this one was just too simple to let it pass :-) --- source3/printing/printfsp.c | 3 +-- source3/printing/printing.c | 4 +++- source3/smbd/fileio.c | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c index b485711f91..243b8ea03b 100644 --- a/source3/printing/printfsp.c +++ b/source3/printing/printfsp.c @@ -88,7 +88,6 @@ NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn, void print_fsp_end(files_struct *fsp, enum file_close_type close_type) { uint32 jobid; - fstring sharename; if (fsp->fh->private_options & FILE_DELETE_ON_CLOSE) { /* @@ -102,7 +101,7 @@ void print_fsp_end(files_struct *fsp, enum file_close_type close_type) string_free(&fsp->fsp_name); } - if (!rap_to_pjobid(fsp->rap_print_jobid, sharename, &jobid)) { + if (!rap_to_pjobid(fsp->rap_print_jobid, NULL, &jobid)) { DEBUG(3,("print_fsp_end: Unable to convert RAP jobid %u to print jobid.\n", (unsigned int)fsp->rap_print_jobid )); return; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 49bd5ac8ba..fc3667ea3a 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -117,7 +117,9 @@ bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid) if ( data.dptr && data.dsize == sizeof(struct rap_jobid_key) ) { struct rap_jobid_key *jinfo = (struct rap_jobid_key*)data.dptr; - fstrcpy( sharename, jinfo->sharename ); + if (sharename != NULL) { + fstrcpy( sharename, jinfo->sharename ); + } *pjobid = jinfo->jobid; DEBUG(10,("rap_to_pjobid: jobid %u maps to RAP jobid %u\n", (unsigned int)*pjobid, (unsigned int)rap_jobid)); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index a9a97a2d14..adf664b396 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -256,10 +256,9 @@ ssize_t write_file(struct smb_request *req, int write_path = -1; if (fsp->print_file) { - fstring sharename; uint32 jobid; - if (!rap_to_pjobid(fsp->rap_print_jobid, sharename, &jobid)) { + if (!rap_to_pjobid(fsp->rap_print_jobid, NULL, &jobid)) { DEBUG(3,("write_file: Unable to map RAP jobid %u to jobid.\n", (unsigned int)fsp->rap_print_jobid )); errno = EBADF; -- cgit