mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r21987: split tdb_prs_*() functions in version which take a keystr and a TDB_DATA key
metze
This commit is contained in:
parent
08d23a1c4f
commit
724c6fa337
@ -125,7 +125,7 @@ SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
|
|||||||
|
|
||||||
slprintf(key, sizeof(key)-1, "SECDESC/%s", servicename);
|
slprintf(key, sizeof(key)-1, "SECDESC/%s", servicename);
|
||||||
|
|
||||||
if (tdb_prs_fetch(share_tdb, key, &ps, ctx)!=0 ||
|
if (tdb_prs_fetch_bystring(share_tdb, key, &ps, ctx)!=0 ||
|
||||||
!sec_io_desc("get_share_security", &psd, &ps, 1)) {
|
!sec_io_desc("get_share_security", &psd, &ps, 1)) {
|
||||||
|
|
||||||
DEBUG(4, ("get_share_security: using default secdesc for %s\n",
|
DEBUG(4, ("get_share_security: using default secdesc for %s\n",
|
||||||
@ -167,7 +167,7 @@ BOOL set_share_security(const char *share_name, SEC_DESC *psd)
|
|||||||
|
|
||||||
slprintf(key, sizeof(key)-1, "SECDESC/%s", share_name);
|
slprintf(key, sizeof(key)-1, "SECDESC/%s", share_name);
|
||||||
|
|
||||||
if (tdb_prs_store(share_tdb, key, &ps)==0) {
|
if (tdb_prs_store_bystring(share_tdb, key, &ps)==0) {
|
||||||
ret = True;
|
ret = True;
|
||||||
DEBUG(5,("set_share_security: stored secdesc for %s\n", share_name ));
|
DEBUG(5,("set_share_security: stored secdesc for %s\n", share_name ));
|
||||||
} else {
|
} else {
|
||||||
|
@ -5159,7 +5159,7 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr)
|
|||||||
|
|
||||||
key = make_printers_secdesc_tdbkey( sharename );
|
key = make_printers_secdesc_tdbkey( sharename );
|
||||||
|
|
||||||
if (tdb_prs_store(tdb_printers, key, &ps)==0) {
|
if (tdb_prs_store_bystring(tdb_printers, key, &ps)==0) {
|
||||||
status = WERR_OK;
|
status = WERR_OK;
|
||||||
} else {
|
} else {
|
||||||
DEBUG(1,("Failed to store secdesc for %s\n", sharename));
|
DEBUG(1,("Failed to store secdesc for %s\n", sharename));
|
||||||
@ -5280,7 +5280,7 @@ BOOL nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **s
|
|||||||
|
|
||||||
key = make_printers_secdesc_tdbkey( sharename );
|
key = make_printers_secdesc_tdbkey( sharename );
|
||||||
|
|
||||||
if (tdb_prs_fetch(tdb_printers, key, &ps, ctx)!=0 ||
|
if (tdb_prs_fetch_bystring(tdb_printers, key, &ps, ctx)!=0 ||
|
||||||
!sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) {
|
!sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) {
|
||||||
|
|
||||||
prs_mem_free(&ps);
|
prs_mem_free(&ps);
|
||||||
@ -5297,7 +5297,7 @@ BOOL nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **s
|
|||||||
sizeof(SEC_DESC_BUF), ctx, MARSHALL);
|
sizeof(SEC_DESC_BUF), ctx, MARSHALL);
|
||||||
|
|
||||||
if (sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) {
|
if (sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) {
|
||||||
tdb_prs_store(tdb_printers, key, &ps);
|
tdb_prs_store_bystring(tdb_printers, key, &ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
prs_mem_free(&ps);
|
prs_mem_free(&ps);
|
||||||
|
@ -1454,22 +1454,24 @@ BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* useful function to store a structure in rpc wire format */
|
/* useful function to store a structure in rpc wire format */
|
||||||
int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps)
|
int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps)
|
||||||
{
|
{
|
||||||
TDB_DATA kbuf, dbuf;
|
TDB_DATA dbuf;
|
||||||
kbuf.dptr = keystr;
|
|
||||||
kbuf.dsize = strlen(keystr)+1;
|
|
||||||
dbuf.dptr = ps->data_p;
|
dbuf.dptr = ps->data_p;
|
||||||
dbuf.dsize = prs_offset(ps);
|
dbuf.dsize = prs_offset(ps);
|
||||||
return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE);
|
return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* useful function to fetch a structure into rpc wire format */
|
int tdb_prs_store_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps)
|
||||||
int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx)
|
|
||||||
{
|
{
|
||||||
TDB_DATA kbuf, dbuf;
|
TDB_DATA kbuf = string_term_tdb_data(keystr);
|
||||||
kbuf.dptr = keystr;
|
return tdb_prs_store(tdb, kbuf, ps);
|
||||||
kbuf.dsize = strlen(keystr)+1;
|
}
|
||||||
|
|
||||||
|
/* useful function to fetch a structure into rpc wire format */
|
||||||
|
int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx)
|
||||||
|
{
|
||||||
|
TDB_DATA dbuf;
|
||||||
|
|
||||||
prs_init(ps, 0, mem_ctx, UNMARSHALL);
|
prs_init(ps, 0, mem_ctx, UNMARSHALL);
|
||||||
|
|
||||||
@ -1482,6 +1484,12 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *me
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tdb_prs_fetch_bystring(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps, TALLOC_CTX *mem_ctx)
|
||||||
|
{
|
||||||
|
TDB_DATA kbuf = string_term_tdb_data(keystr);
|
||||||
|
return tdb_prs_fetch(tdb, kbuf, ps, mem_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
hash a stream.
|
hash a stream.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user