fstring key;
uint32 status;
- prs_init(&ps, (uint32)sec_desc_size(secdesc_ctr->sec), 4, MARSHALL);
+ prs_init(&ps, (uint32)sec_desc_size(secdesc_ctr->sec) + sizeof(SEC_DESC_BUF), 4, MARSHALL);
if (!sec_io_desc_buf("nt_printing_setsec", &secdesc_ctr, &ps, 1)) {
status = ERROR_INVALID_FUNCTION;
static SEC_DESC_BUF *construct_default_printer_sdb(void)
{
extern DOM_SID global_sid_World;
+ SEC_ACE ace;
+ SEC_ACCESS sa;
+ SEC_ACL *psa = NULL;
SEC_DESC_BUF *sdb = NULL;
+ SEC_DESC *psd = NULL;
size_t sd_size;
- SEC_DESC *psd = make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT,
- &global_sid_World, &global_sid_World,
- NULL, NULL, &sd_size);
+
+ init_sec_access(&sa,PRINTER_ALL_ACCESS);
+ init_sec_ace(&ace, &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, sa, 0);
+
+ if ((psa = make_sec_acl( 3, 1, &ace)) != NULL) {
+ psd = make_sec_desc(1, SEC_DESC_SELF_RELATIVE|SEC_DESC_DACL_PRESENT,
+ &global_sid_World, &global_sid_World,
+ NULL, psa, &sd_size);
+ free_sec_acl(&psa);
+ }
if (!psd) {
DEBUG(0,("construct_default_printer_sd: Failed to make SEC_DESC.\n"));
sdb = make_sec_desc_buf(sd_size, psd);
+ DEBUG(4,("construct_default_printer_sdb: size = %u.\n", (unsigned int)sd_size));
+
free_sec_desc(&psd);
return sdb;
}
if(UNMARSHALLING(ps) || !ps->is_dynamic) {
DEBUG(0,("prs_grow: Buffer overflow - unable to expand buffer by %u bytes.\n",
(unsigned int)extra_space));
+ /* JRATEST */
+ smb_panic("prs_grow");
+ /* JRATEST */
return False;
}
psd = *ppsd;
- if(UNMARSHALLING(ps) && psd == NULL) {
- if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL)
- return False;
- ZERO_STRUCTP(psd);
- *ppsd = psd;
+ if (psd == NULL) {
+ if(UNMARSHALLING(ps)) {
+ if((psd = (SEC_DESC *)malloc(sizeof(SEC_DESC))) == NULL)
+ return False;
+ ZERO_STRUCTP(psd);
+ *ppsd = psd;
+ } else {
+ /* Marshalling - just ignore. */
+ return True;
+ }
}
prs_debug(ps, depth, desc, "sec_io_desc");
old_offset = prs_offset(ps);
/* reading, length is non-zero; writing, descriptor is non-NULL */
- if ((psdb->len != 0 || MARSHALLING(ps)) && psdb->sec != NULL) {
+ if ((UNMARSHALLING(ps) && psdb->len != 0) || (MARSHALLING(ps) && psdb->sec != NULL)) {
if(!sec_io_desc("sec ", &psdb->sec, ps, depth))
return False;
}
DEBUG(0,("construct_printer_info_3: malloc fail.\n"));
return False;
}
+
+ ZERO_STRUCTP(printer);
printer->flags = 4; /* This is the offset to the SEC_DESC. */
if (ntprinter->info_2->secdesc_buf->len != 0) {
desc.subcount = count;
fill_printq_info(conn,snum,uLevel,&desc,count,queue,&status);
} else if(uLevel == 0) {
+#if 0
/*
* This is a *disgusting* hack.
* This is *so* bad that even I'm embarrassed (and I
*/
fail_next_srvsvc_open();
+#endif
}
*rdata_len = desc.usedlen;
return smb_open_mode;
}
+#if 0
/*
* This is a *disgusting* hack.
* This is *so* bad that even I'm embarrassed (and I
}
return False;
}
-
+#endif
/****************************************************************************
Reply to an NT create and X call on a pipe.
/* Strip \\ off the name. */
fname++;
+#if 0
if(should_fail_next_srvsvc_open(fname))
return (ERROR(ERRSRV,ERRaccess));
+#endif
DEBUG(3,("nt_open_pipe: Known pipe %s opening.\n", fname));
/* Strip \PIPE\ off the name. */
pstrcpy(fname,smb_buf(inbuf) + PIPELEN);
+#if 0
/*
* Hack for NT printers... JRA.
*/
if(should_fail_next_srvsvc_open(fname))
return(ERROR(ERRSRV,ERRaccess));
+#endif
/* Known pipes arrive with DIR attribs. Remove it so a regular file */
/* can be opened and add it in after the open. */
TDB_DATA kbuf, dbuf;
kbuf.dptr = keystr;
kbuf.dsize = strlen(keystr)+1;
- dbuf.dptr = ps->data_p;
- dbuf.dsize = ps->data_offset;
+ dbuf.dptr = prs_data_p(ps);
+ dbuf.dsize = prs_offset(ps);
return tdb_store(tdb, kbuf, dbuf, TDB_REPLACE);
}
if (!dbuf.dptr) return -1;
ZERO_STRUCTP(ps);
- ps->io = UNMARSHALL;
- ps->align = 4;
- ps->data_p = dbuf.dptr;
- ps->data_offset = 0;
- ps->buffer_size = dbuf.dsize;
- ps->grow_size = dbuf.dsize;
+ prs_init(ps, 0, 4, UNMARSHALL);
+ prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True);
return 0;
}