⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 srv_spoolss.c

📁 samba-3.0.22.tar.gz 编译smb服务器的源码
💻 C
📖 第 1 页 / 共 4 页
字号:
/*  *  Unix SMB/CIFS implementation. *  RPC Pipe client / server routines *  Copyright (C) Andrew Tridgell              1992-2000, *  Copyright (C) Luke Kenneth Casson Leighton 1996-2000, *  Copyright (C) Jean Fran鏾is Micouleau      1998-2000, *  Copyright (C) Jeremy Allison                    2001, *  Copyright (C) Gerald Carter                2001-2002, *  Copyright (C) Jim McDonough <jmcd@us.ibm.com>   2003. *   *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. *   *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. *   *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#include "includes.h"#undef DBGC_CLASS#define DBGC_CLASS DBGC_RPC_SRV/******************************************************************** * api_spoolss_open_printer_ex (rarely seen - older call) ********************************************************************/static BOOL api_spoolss_open_printer(pipes_struct *p){	SPOOL_Q_OPEN_PRINTER q_u;	SPOOL_R_OPEN_PRINTER r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_open_printer("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_open_printer: unable to unmarshall SPOOL_Q_OPEN_PRINTER.\n"));		return False;	}	r_u.status = _spoolss_open_printer( p, &q_u, &r_u);		if (!spoolss_io_r_open_printer("",&r_u,rdata,0)){		DEBUG(0,("spoolss_io_r_open_printer: unable to marshall SPOOL_R_OPEN_PRINTER.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_open_printer_ex ********************************************************************/static BOOL api_spoolss_open_printer_ex(pipes_struct *p){	SPOOL_Q_OPEN_PRINTER_EX q_u;	SPOOL_R_OPEN_PRINTER_EX r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_open_printer_ex("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_open_printer_ex: unable to unmarshall SPOOL_Q_OPEN_PRINTER_EX.\n"));		return False;	}	r_u.status = _spoolss_open_printer_ex( p, &q_u, &r_u);	if (!spoolss_io_r_open_printer_ex("",&r_u,rdata,0)){		DEBUG(0,("spoolss_io_r_open_printer_ex: unable to marshall SPOOL_R_OPEN_PRINTER_EX.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_getprinterdata * * called from the spoolss dispatcher ********************************************************************/static BOOL api_spoolss_getprinterdata(pipes_struct *p){	SPOOL_Q_GETPRINTERDATA q_u;	SPOOL_R_GETPRINTERDATA r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	/* read the stream and fill the struct */	if (!spoolss_io_q_getprinterdata("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_getprinterdata: unable to unmarshall SPOOL_Q_GETPRINTERDATA.\n"));		return False;	}		r_u.status = _spoolss_getprinterdata( p, &q_u, &r_u);	if (!spoolss_io_r_getprinterdata("", &r_u, rdata, 0)) {		DEBUG(0,("spoolss_io_r_getprinterdata: unable to marshall SPOOL_R_GETPRINTERDATA.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_deleteprinterdata * * called from the spoolss dispatcher ********************************************************************/static BOOL api_spoolss_deleteprinterdata(pipes_struct *p){	SPOOL_Q_DELETEPRINTERDATA q_u;	SPOOL_R_DELETEPRINTERDATA r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	/* read the stream and fill the struct */	if (!spoolss_io_q_deleteprinterdata("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_deleteprinterdata: unable to unmarshall SPOOL_Q_DELETEPRINTERDATA.\n"));		return False;	}		r_u.status = _spoolss_deleteprinterdata( p, &q_u, &r_u );	if (!spoolss_io_r_deleteprinterdata("", &r_u, rdata, 0)) {		DEBUG(0,("spoolss_io_r_deleteprinterdata: unable to marshall SPOOL_R_DELETEPRINTERDATA.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_closeprinter * * called from the spoolss dispatcher ********************************************************************/static BOOL api_spoolss_closeprinter(pipes_struct *p){	SPOOL_Q_CLOSEPRINTER q_u;	SPOOL_R_CLOSEPRINTER r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_closeprinter("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_closeprinter: unable to unmarshall SPOOL_Q_CLOSEPRINTER.\n"));		return False;	}	r_u.status = _spoolss_closeprinter(p, &q_u, &r_u);	if (!spoolss_io_r_closeprinter("",&r_u,rdata,0)) {		DEBUG(0,("spoolss_io_r_closeprinter: unable to marshall SPOOL_R_CLOSEPRINTER.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_abortprinter * * called from the spoolss dispatcher ********************************************************************/static BOOL api_spoolss_abortprinter(pipes_struct *p){	SPOOL_Q_ABORTPRINTER q_u;	SPOOL_R_ABORTPRINTER r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_abortprinter("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_abortprinter: unable to unmarshall SPOOL_Q_ABORTPRINTER.\n"));		return False;	}	r_u.status = _spoolss_abortprinter(p, &q_u, &r_u);	if (!spoolss_io_r_abortprinter("",&r_u,rdata,0)) {		DEBUG(0,("spoolss_io_r_abortprinter: unable to marshall SPOOL_R_ABORTPRINTER.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_deleteprinter * * called from the spoolss dispatcher ********************************************************************/static BOOL api_spoolss_deleteprinter(pipes_struct *p){	SPOOL_Q_DELETEPRINTER q_u;	SPOOL_R_DELETEPRINTER r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_deleteprinter("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_deleteprinter: unable to unmarshall SPOOL_Q_DELETEPRINTER.\n"));		return False;	}	r_u.status = _spoolss_deleteprinter(p, &q_u, &r_u);	if (!spoolss_io_r_deleteprinter("",&r_u,rdata,0)) {		DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_deleteprinterdriver * * called from the spoolss dispatcher ********************************************************************/static BOOL api_spoolss_deleteprinterdriver(pipes_struct *p){	SPOOL_Q_DELETEPRINTERDRIVER q_u;	SPOOL_R_DELETEPRINTERDRIVER r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_deleteprinterdriver("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_deleteprinterdriver: unable to unmarshall SPOOL_Q_DELETEPRINTERDRIVER.\n"));		return False;	}	r_u.status = _spoolss_deleteprinterdriver(p, &q_u, &r_u);	if (!spoolss_io_r_deleteprinterdriver("",&r_u,rdata,0)) {		DEBUG(0,("spoolss_io_r_deleteprinter: unable to marshall SPOOL_R_DELETEPRINTER.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_rffpcnex * ReplyFindFirstPrinterChangeNotifyEx ********************************************************************/static BOOL api_spoolss_rffpcnex(pipes_struct *p){	SPOOL_Q_RFFPCNEX q_u;	SPOOL_R_RFFPCNEX r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_rffpcnex("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_rffpcnex: unable to unmarshall SPOOL_Q_RFFPCNEX.\n"));		return False;	}	r_u.status = _spoolss_rffpcnex(p, &q_u, &r_u);	if (!spoolss_io_r_rffpcnex("", &r_u, rdata, 0)) {		DEBUG(0,("spoolss_io_r_rffpcnex: unable to marshall SPOOL_R_RFFPCNEX.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_rfnpcnex * ReplyFindNextPrinterChangeNotifyEx * called from the spoolss dispatcher * Note - this is the *ONLY* function that breaks the RPC call * symmetry in all the other calls. We need to do this to fix * the massive memory allocation problem with thousands of jobs... * JRA. ********************************************************************/static BOOL api_spoolss_rfnpcnex(pipes_struct *p){	SPOOL_Q_RFNPCNEX q_u;	SPOOL_R_RFNPCNEX r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_rfnpcnex("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_rfnpcnex: unable to unmarshall SPOOL_Q_RFNPCNEX.\n"));		return False;	}	r_u.status = _spoolss_rfnpcnex(p, &q_u, &r_u);	if (!spoolss_io_r_rfnpcnex("", &r_u, rdata, 0)) {		SAFE_FREE(r_u.info.data);		DEBUG(0,("spoolss_io_r_rfnpcnex: unable to marshall SPOOL_R_RFNPCNEX.\n"));		return False;	}	SAFE_FREE(r_u.info.data);	return True;}/******************************************************************** * api_spoolss_enumprinters * called from the spoolss dispatcher * ********************************************************************/static BOOL api_spoolss_enumprinters(pipes_struct *p){	SPOOL_Q_ENUMPRINTERS q_u;	SPOOL_R_ENUMPRINTERS r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if (!spoolss_io_q_enumprinters("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_enumprinters: unable to unmarshall SPOOL_Q_ENUMPRINTERS.\n"));		return False;	}	r_u.status = _spoolss_enumprinters( p, &q_u, &r_u);	if (!spoolss_io_r_enumprinters("", &r_u, rdata, 0)) {		DEBUG(0,("spoolss_io_r_enumprinters: unable to marshall SPOOL_R_ENUMPRINTERS.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_getprinter * called from the spoolss dispatcher * ********************************************************************/static BOOL api_spoolss_getprinter(pipes_struct *p){	SPOOL_Q_GETPRINTER q_u;	SPOOL_R_GETPRINTER r_u;	prs_struct *data = &p->in_data.data;	prs_struct *rdata = &p->out_data.rdata;	ZERO_STRUCT(q_u);	ZERO_STRUCT(r_u);	if(!spoolss_io_q_getprinter("", &q_u, data, 0)) {		DEBUG(0,("spoolss_io_q_getprinter: unable to unmarshall SPOOL_Q_GETPRINTER.\n"));		return False;	}	r_u.status = _spoolss_getprinter(p, &q_u, &r_u);	if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) {		DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));		return False;	}	return True;}/******************************************************************** * api_spoolss_getprinter

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -