summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-29 23:00:49 +0100
committerVolker Lendecke <vl@samba.org>2007-12-29 23:13:26 +0100
commit7cbdb48475b0340154fad60cb4b7cc53dc2bbcfd (patch)
treec46834dc96c1bd189ab4e37d9afe38a309d14abb /source3
parent7be5525792a2f4aa19c308afb516ef1fe02b7be2 (diff)
downloadsamba-7cbdb48475b0340154fad60cb4b7cc53dc2bbcfd.tar.gz
samba-7cbdb48475b0340154fad60cb4b7cc53dc2bbcfd.tar.bz2
samba-7cbdb48475b0340154fad60cb4b7cc53dc2bbcfd.zip
Remove tiny code duplication
ndr_size_security_descriptor does the same as sec_desc_size (This used to be commit bc3bd7a8e7c6e9e27acb195c86abb92c0f53112f)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/secdesc.c29
-rw-r--r--source3/lib/sharesec.c2
-rw-r--r--source3/modules/nfs4_acls.c2
-rw-r--r--source3/printing/nt_printing.c10
-rw-r--r--source3/registry/reg_api.c2
-rw-r--r--source3/registry/regfio.c5
-rw-r--r--source3/rpc_parse/parse_buffer.c2
-rw-r--r--source3/rpc_parse/parse_sec.c2
-rw-r--r--source3/rpc_parse/parse_spoolss.c4
-rw-r--r--source3/rpc_parse/parse_srv.c5
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c2
-rw-r--r--source3/rpc_server/srv_svcctl_nt.c2
-rw-r--r--source3/smbd/nttrans.c2
13 files changed, 22 insertions, 47 deletions
diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c
index 5e5042e521..44ae23271e 100644
--- a/source3/lib/secdesc.c
+++ b/source3/lib/secdesc.c
@@ -32,35 +32,6 @@ const struct generic_mapping file_generic_mapping = {
};
/*******************************************************************
- Works out the linearization size of a SEC_DESC.
-********************************************************************/
-
-size_t sec_desc_size(SEC_DESC *psd)
-{
- size_t offset;
-
- if (!psd) return 0;
-
- offset = SEC_DESC_HEADER_SIZE;
-
- /* don't align */
-
- if (psd->owner_sid != NULL)
- offset += ndr_size_dom_sid(psd->owner_sid, 0);
-
- if (psd->group_sid != NULL)
- offset += ndr_size_dom_sid(psd->group_sid, 0);
-
- if (psd->sacl != NULL)
- offset += psd->sacl->size;
-
- if (psd->dacl != NULL)
- offset += psd->dacl->size;
-
- return offset;
-}
-
-/*******************************************************************
Compares two SEC_DESC structures
********************************************************************/
diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c
index 0027a8813a..ba025dacc1 100644
--- a/source3/lib/sharesec.c
+++ b/source3/lib/sharesec.c
@@ -144,7 +144,7 @@ SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
}
if (psd)
- *psize = sec_desc_size(psd);
+ *psize = ndr_size_security_descriptor(psd, 0);
return psd;
}
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 70bb6a02e8..6d2972d8ed 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -309,7 +309,7 @@ static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf,
}
DEBUG(10, ("smb_get_nt_acl_nfs4_common successfully exited with sd_size %d\n",
- sec_desc_size(*ppdesc)));
+ ndr_size_security_descriptor(*ppdesc, 0)));
return NT_STATUS_OK;
}
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index f83f898cc0..f115fba91f 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -429,7 +429,8 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
/* store it back */
- sd_size = sec_desc_size(sd_store->sd) + sizeof(SEC_DESC_BUF);
+ sd_size = ndr_size_security_descriptor(sd_store->sd, 0)
+ + sizeof(SEC_DESC_BUF);
prs_init(&ps, sd_size, ctx, MARSHALL);
if ( !sec_io_desc_buf( "sec_desc_upg_fn", &sd_store, &ps, 1 ) ) {
@@ -5389,8 +5390,9 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr)
/* Store the security descriptor in a tdb */
- prs_init(&ps, (uint32)sec_desc_size(new_secdesc_ctr->sd) +
- sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL);
+ prs_init(&ps,
+ (uint32)ndr_size_security_descriptor(new_secdesc_ctr->sd, 0)
+ + sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL);
if (!sec_io_desc_buf("nt_printing_setsec", &new_secdesc_ctr,
&ps, 1)) {
@@ -5534,7 +5536,7 @@ bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **s
/* Save default security descriptor for later */
- prs_init(&ps, (uint32)sec_desc_size((*secdesc_ctr)->sd) +
+ prs_init(&ps, (uint32)ndr_size_security_descriptor((*secdesc_ctr)->sd, 0) +
sizeof(SEC_DESC_BUF), ctx, MARSHALL);
if (sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) {
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c
index b3d024d7b4..bc4508ff94 100644
--- a/source3/registry/reg_api.c
+++ b/source3/registry/reg_api.c
@@ -378,7 +378,7 @@ WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys,
return err;
}
- *secdescsize = sec_desc_size(secdesc);
+ *secdescsize = ndr_size_security_descriptor(secdesc, 0);
TALLOC_FREE(mem_ctx);
*last_changed_time = 0;
diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c
index 22700e6481..92077aa847 100644
--- a/source3/registry/regfio.c
+++ b/source3/registry/regfio.c
@@ -1554,7 +1554,7 @@ static uint32 sk_record_data_size( SEC_DESC * sd )
/* the record size is sizeof(hdr) + name + static members + data_size_field */
- size = sizeof(uint32)*5 + sec_desc_size( sd ) + sizeof(uint32);
+ size = sizeof(uint32)*5 + ndr_size_security_descriptor(sd, 0) + sizeof(uint32);
/* multiple of 8 */
size_mod8 = size & 0xfffffff8;
@@ -1784,7 +1784,8 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
nk->sec_desc->ref_count = 0;
/* size value must be self-inclusive */
- nk->sec_desc->size = sec_desc_size(sec_desc) + sizeof(uint32);
+ nk->sec_desc->size = ndr_size_security_descriptor(sec_desc, 0)
+ + sizeof(uint32);
DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, REGF_SK_REC *);
diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c
index c30ad487dd..e98822d46e 100644
--- a/source3/rpc_parse/parse_buffer.c
+++ b/source3/rpc_parse/parse_buffer.c
@@ -435,7 +435,7 @@ bool smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC
}
if (*secdesc != NULL) {
- buffer->string_at_end -= sec_desc_size(*secdesc);
+ buffer->string_at_end -= ndr_size_security_descriptor(*secdesc, 0);
if(!prs_set_offset(ps, buffer->string_at_end))
return False;
diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c
index 36bd5825bd..6ea128d3a4 100644
--- a/source3/rpc_parse/parse_sec.c
+++ b/source3/rpc_parse/parse_sec.c
@@ -426,7 +426,7 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
if(!prs_uint32 ("ptr ", ps, depth, &ptr))
return False;
- len = sec_desc_size(psdb->sd);
+ len = ndr_size_security_descriptor(psdb->sd, 0);
if(!prs_uint32_pre("len ", ps, depth, &len, &off_len))
return False;
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index ea76c57045..3bf8ef27c1 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -3098,7 +3098,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info)
size += 4;
- size += sec_desc_size( info->secdesc );
+ size += ndr_size_security_descriptor( info->secdesc, 0 );
size+=size_of_device_mode( info->devmode );
@@ -3185,7 +3185,7 @@ return the size required by a struct in the stream
uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info)
{
/* The 8 is for the self relative pointer - 8 byte aligned.. */
- return 8 + (uint32)sec_desc_size( info->secdesc );
+ return 8 + (uint32)ndr_size_security_descriptor( info->secdesc, 0 );
}
/*******************************************************************
diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c
index 6337c53fc1..954aa80600 100644
--- a/source3/rpc_parse/parse_srv.c
+++ b/source3/rpc_parse/parse_srv.c
@@ -507,7 +507,8 @@ static bool srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, p
if(UNMARSHALLING(ps)) {
- sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd);
+ sh502->ptrs->sd_size = sh502->sd_size =
+ ndr_size_security_descriptor(sh502->sd, 0);
prs_set_offset(ps, old_offset + sh502->reserved);
}
@@ -1460,7 +1461,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname,
{
switch(level) {
case 502: {
- size_t sd_size = sec_desc_size(sd);
+ size_t sd_size = ndr_size_security_descriptor(sd, 0);
q->ptr_srv_name = 1;
init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE);
q->info.switch_value = q->info_level = level;
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index 842a28c776..01e5cf2cda 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -2159,7 +2159,7 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC
goto error_exit;
}
- sd_size = sec_desc_size(psd);
+ sd_size = ndr_size_security_descriptor(psd, 0);
r_u->ptr_response = 1;
r_u->size_response = sd_size;
diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c
index 3f5cf03abb..ac45d8bf75 100644
--- a/source3/rpc_server/srv_svcctl_nt.c
+++ b/source3/rpc_server/srv_svcctl_nt.c
@@ -813,7 +813,7 @@ WERROR _svcctl_query_service_sec( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_SEC *q
if ( !(sec_desc = svcctl_get_secdesc( p->mem_ctx, info->name, get_root_nt_token() )) )
return WERR_NOMEM;
- r_u->needed = sec_desc_size( sec_desc );
+ r_u->needed = ndr_size_security_descriptor( sec_desc, 0 );
if ( r_u->needed > q_u->buffer_size ) {
ZERO_STRUCTP( &r_u->buffer );
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index eb29e65935..69772b6bec 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1650,7 +1650,7 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
return;
}
- sd_size = sec_desc_size(psd);
+ sd_size = ndr_size_security_descriptor(psd, 0);
DEBUG(3,("call_nt_transact_query_security_desc: sd_size = %lu.\n",(unsigned long)sd_size));