mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
*Experimental* new large-scaling printer code. Splits printing.tdb into
a separate tdb per printer, but only keeps (currently one) tdb open at a time (although this is easily changed by changing a #define). Needs scalability testing with large numbers of printers now.... Jeremy.
This commit is contained in:
parent
202202bc47
commit
b0909cfa14
@ -1859,7 +1859,7 @@ char *myhostname(void)
|
||||
/*****************************************************************
|
||||
a useful function for returning a path in the Samba lock directory
|
||||
*****************************************************************/
|
||||
char *lock_path(char *name)
|
||||
char *lock_path(const char *name)
|
||||
{
|
||||
static pstring fname;
|
||||
|
||||
@ -1879,7 +1879,7 @@ char *lock_path(char *name)
|
||||
/*****************************************************************
|
||||
a useful function for returning a path in the Samba pid directory
|
||||
*****************************************************************/
|
||||
char *pid_path(char *name)
|
||||
char *pid_path(const char *name)
|
||||
{
|
||||
static pstring fname;
|
||||
|
||||
@ -1904,7 +1904,7 @@ char *pid_path(char *name)
|
||||
*
|
||||
* @retval Pointer to a static #pstring containing the full path.
|
||||
**/
|
||||
char *lib_path(char *name)
|
||||
char *lib_path(const char *name)
|
||||
{
|
||||
static pstring fname;
|
||||
snprintf(fname, sizeof(fname), "%s/%s", dyn_LIBDIR, name);
|
||||
|
@ -1971,6 +1971,7 @@ static BOOL lp_add_ipc(char *ipc_name, BOOL guest_ok)
|
||||
return (True);
|
||||
}
|
||||
|
||||
BOOL (*register_printer_fn)(const char *);
|
||||
|
||||
/***************************************************************************
|
||||
add a new printer service, with defaults coming from service iFrom.
|
||||
@ -2004,6 +2005,8 @@ BOOL lp_add_printer(char *pszPrintername, int iDefaultService)
|
||||
DEBUG(3, ("adding printer service %s\n", pszPrintername));
|
||||
|
||||
update_server_announce_as_printserver();
|
||||
if (register_printer_fn && (!(*register_printer_fn)(pszPrintername)))
|
||||
return False;
|
||||
|
||||
return (True);
|
||||
}
|
||||
@ -3878,11 +3881,11 @@ void lp_set_name_resolve_order(char *new_order)
|
||||
Globals.szNameResolveOrder = new_order;
|
||||
}
|
||||
|
||||
char *lp_printername(int snum)
|
||||
const char *lp_printername(int snum)
|
||||
{
|
||||
char *ret = _lp_printername(snum);
|
||||
const char *ret = _lp_printername(snum);
|
||||
if (ret == NULL || (ret != NULL && *ret == '\0'))
|
||||
ret = lp_servicename(snum);
|
||||
ret = lp_const_servicename(snum);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ static void send_notify_field_buffer(const char *printer_name, uint32 type,
|
||||
|
||||
/* Send a message that the printer status has changed */
|
||||
|
||||
void notify_printer_status_byname(char *printer_name, uint32 status)
|
||||
void notify_printer_status_byname(const char *printer_name, uint32 status)
|
||||
{
|
||||
/* Printer status stored in value1 */
|
||||
|
||||
@ -129,13 +129,13 @@ void notify_printer_status_byname(char *printer_name, uint32 status)
|
||||
|
||||
void notify_printer_status(int snum, uint32 status)
|
||||
{
|
||||
char *printer_name = PRINTERNAME(snum);
|
||||
const char *printer_name = PRINTERNAME(snum);
|
||||
|
||||
if (printer_name)
|
||||
notify_printer_status_byname(printer_name, status);
|
||||
}
|
||||
|
||||
void notify_job_status_byname(char *printer_name, uint32 jobid, uint32 status,
|
||||
void notify_job_status_byname(const char *printer_name, uint32 jobid, uint32 status,
|
||||
uint32 flags)
|
||||
{
|
||||
/* Job id stored in id field, status in value1 */
|
||||
@ -147,14 +147,14 @@ void notify_job_status_byname(char *printer_name, uint32 jobid, uint32 status,
|
||||
|
||||
void notify_job_status(int snum, uint32 jobid, uint32 status)
|
||||
{
|
||||
char *printer_name = PRINTERNAME(snum);
|
||||
const char *printer_name = PRINTERNAME(snum);
|
||||
|
||||
notify_job_status_byname(printer_name, jobid, status, 0);
|
||||
}
|
||||
|
||||
void notify_job_total_bytes(int snum, uint32 jobid, uint32 size)
|
||||
{
|
||||
char *printer_name = PRINTERNAME(snum);
|
||||
const char *printer_name = PRINTERNAME(snum);
|
||||
|
||||
/* Job id stored in id field, status in value1 */
|
||||
|
||||
@ -165,7 +165,7 @@ void notify_job_total_bytes(int snum, uint32 jobid, uint32 size)
|
||||
|
||||
void notify_job_total_pages(int snum, uint32 jobid, uint32 pages)
|
||||
{
|
||||
char *printer_name = PRINTERNAME(snum);
|
||||
const char *printer_name = PRINTERNAME(snum);
|
||||
|
||||
/* Job id stored in id field, status in value1 */
|
||||
|
||||
@ -176,7 +176,7 @@ void notify_job_total_pages(int snum, uint32 jobid, uint32 pages)
|
||||
|
||||
void notify_job_username(int snum, uint32 jobid, char *name)
|
||||
{
|
||||
char *printer_name = PRINTERNAME(snum);
|
||||
const char *printer_name = PRINTERNAME(snum);
|
||||
|
||||
send_notify_field_buffer(
|
||||
printer_name, JOB_NOTIFY_TYPE, JOB_NOTIFY_USER_NAME,
|
||||
@ -185,7 +185,7 @@ void notify_job_username(int snum, uint32 jobid, char *name)
|
||||
|
||||
void notify_job_name(int snum, uint32 jobid, char *name)
|
||||
{
|
||||
char *printer_name = PRINTERNAME(snum);
|
||||
const char *printer_name = PRINTERNAME(snum);
|
||||
|
||||
send_notify_field_buffer(
|
||||
printer_name, JOB_NOTIFY_TYPE, JOB_NOTIFY_DOCUMENT,
|
||||
@ -194,7 +194,7 @@ void notify_job_name(int snum, uint32 jobid, char *name)
|
||||
|
||||
void notify_job_submitted(int snum, uint32 jobid, time_t submitted)
|
||||
{
|
||||
char *printer_name = PRINTERNAME(snum);
|
||||
const char *printer_name = PRINTERNAME(snum);
|
||||
|
||||
send_notify_field_buffer(
|
||||
printer_name, JOB_NOTIFY_TYPE, JOB_NOTIFY_SUBMITTED,
|
||||
|
@ -3593,7 +3593,7 @@ BOOL get_specific_param(NT_PRINTER_INFO_LEVEL printer, uint32 level,
|
||||
Store a security desc for a printer.
|
||||
****************************************************************************/
|
||||
|
||||
WERROR nt_printing_setsec(char *printername, SEC_DESC_BUF *secdesc_ctr)
|
||||
WERROR nt_printing_setsec(const char *printername, SEC_DESC_BUF *secdesc_ctr)
|
||||
{
|
||||
SEC_DESC_BUF *new_secdesc_ctr = NULL;
|
||||
SEC_DESC_BUF *old_secdesc_ctr = NULL;
|
||||
@ -3754,7 +3754,7 @@ static SEC_DESC_BUF *construct_default_printer_sdb(TALLOC_CTX *ctx)
|
||||
Get a security desc for a printer.
|
||||
****************************************************************************/
|
||||
|
||||
BOOL nt_printing_getsec(TALLOC_CTX *ctx, char *printername, SEC_DESC_BUF **secdesc_ctr)
|
||||
BOOL nt_printing_getsec(TALLOC_CTX *ctx, const char *printername, SEC_DESC_BUF **secdesc_ctr)
|
||||
{
|
||||
prs_struct ps;
|
||||
fstring key;
|
||||
@ -3782,7 +3782,7 @@ BOOL nt_printing_getsec(TALLOC_CTX *ctx, char *printername, SEC_DESC_BUF **secde
|
||||
prs_init(&ps, (uint32)sec_desc_size((*secdesc_ctr)->sec) +
|
||||
sizeof(SEC_DESC_BUF), ctx, MARSHALL);
|
||||
|
||||
if (sec_io_desc_buf("nt_printing_setsec", secdesc_ctr, &ps, 1))
|
||||
if (sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1))
|
||||
tdb_prs_store(tdb_printers, key, &ps);
|
||||
|
||||
prs_mem_free(&ps);
|
||||
@ -3923,7 +3923,7 @@ BOOL print_access_check(struct current_user *user, int snum, int access_type)
|
||||
uint32 access_granted;
|
||||
NTSTATUS status;
|
||||
BOOL result;
|
||||
char *pname;
|
||||
const char *pname;
|
||||
TALLOC_CTX *mem_ctx = NULL;
|
||||
extern struct current_user current_user;
|
||||
|
||||
|
@ -55,7 +55,7 @@ static int print_run_command(int snum,char *command, int *outfd, ...)
|
||||
{
|
||||
|
||||
pstring syscmd;
|
||||
char *p, *arg;
|
||||
char *arg;
|
||||
int ret;
|
||||
va_list ap;
|
||||
va_start(ap, outfd);
|
||||
@ -75,9 +75,7 @@ static int print_run_command(int snum,char *command, int *outfd, ...)
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
p = PRINTERNAME(snum);
|
||||
|
||||
pstring_sub(syscmd, "%p", p);
|
||||
pstring_sub(syscmd, "%p", PRINTERNAME(snum));
|
||||
standard_sub_snum(snum,syscmd,sizeof(syscmd));
|
||||
|
||||
ret = smbrun(syscmd,outfd);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -382,6 +382,8 @@ BOOL reload_services(BOOL test)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
set_register_printer_fn();
|
||||
|
||||
if (lp_loaded()) {
|
||||
pstring fname;
|
||||
pstrcpy(fname,lp_configfile());
|
||||
|
@ -419,7 +419,8 @@ static int rec_free_read(TDB_CONTEXT *tdb, tdb_off off, struct list_struct *rec)
|
||||
TDB_LOG((tdb, 0,"rec_free_read non-free magic at offset=%d - fixing\n",
|
||||
rec->magic, off));
|
||||
rec->magic = TDB_FREE_MAGIC;
|
||||
tdb_write(tdb, off, rec, sizeof(*rec));
|
||||
if (tdb_write(tdb, off, rec, sizeof(*rec)) == -1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rec->magic != TDB_FREE_MAGIC) {
|
||||
|
Loading…
Reference in New Issue
Block a user