diff options
author | Luke Leighton <lkcl@samba.org> | 2000-04-04 02:34:38 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 2000-04-04 02:34:38 +0000 |
commit | 32a214c579233dd789dab8e0bd4f041aea581ce4 (patch) | |
tree | b5bfb4de157bfcaaaba1c1689d8508b33683a13b | |
parent | 4ffb2b3c7b4e4c114f659c028df00d322efb1fa8 (diff) | |
download | samba-32a214c579233dd789dab8e0bd4f041aea581ce4.tar.gz |
more merge of cvs main printing into tng.
i also missed srv_lsa.c in the remove-rpcsrv_struct frenzy.
-rw-r--r-- | source/Makefile.in | 6 | ||||
-rw-r--r-- | source/include/ntdomain.h | 1 | ||||
-rw-r--r-- | source/lsarpcd/srv_lsa.c | 37 | ||||
-rw-r--r-- | source/msrpc/msrpcd_process.c | 34 | ||||
-rw-r--r-- | source/printing/nt_printing.c | 2 | ||||
-rw-r--r-- | source/printing/pcap.c | 23 | ||||
-rw-r--r-- | source/printing/print_svid.c | 21 | ||||
-rw-r--r-- | source/rpc_parse/parse_prs.c | 1 | ||||
-rw-r--r-- | source/rpc_server/srv_pipe_noauth.c | 5 | ||||
-rw-r--r-- | source/rpc_server/srv_pipe_srv.c | 41 | ||||
-rw-r--r-- | source/smbd/lanman.c | 1 |
11 files changed, 101 insertions, 71 deletions
diff --git a/source/Makefile.in b/source/Makefile.in index 1abfff4a17d..09d684e3709 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -271,7 +271,8 @@ SMBD_OBJ1 = smbd/server.o smbd/files.o smbd/connection.o \ smbd/service.o smbd/error.o smbd/vfs.o smbd/vfs-wrap.o \ smbd/challenge.o lib/util_pwdb.o smbd/afsticket.o -PRINTING_OBJ = printing/pcap.o printing/print_svid.o printing/printing.o +PRINTING_OBJ = printing/pcap.o printing/print_svid.o printing/printing.o \ + print_cups.o MSDFS_OBJ = msdfs/msdfs.o msdfs/msdfs_tdb.o msdfs/parse_dfs_map.o @@ -469,7 +470,8 @@ STATUS_OBJ = utils/status.o $(LIBSTATUS_OBJ) $(LOCKING_OBJ) \ TESTPARM_OBJ = utils/testparm.o -TESTPRNS_OBJ = utils/testprns.o printing/pcap.o printing/print_svid.o +TESTPRNS_OBJ = utils/testprns.o printing/pcap.o printing/print_svid.o \ + print_cups.o SMBPASSWD_OBJ = utils/smbpasswd.o libsmb/passchange.o \ rpc_server/srv_lookup.o \ diff --git a/source/include/ntdomain.h b/source/include/ntdomain.h index b8d1c67c182..8e2059948cb 100644 --- a/source/include/ntdomain.h +++ b/source/include/ntdomain.h @@ -152,6 +152,7 @@ typedef struct rpcsrv_struct RPC_HDR_REQ hdr_req; vuser_key key; + vuser_key initial_pipe_key; int c; /* socket */ diff --git a/source/lsarpcd/srv_lsa.c b/source/lsarpcd/srv_lsa.c index d92aca30c4f..364c3ba6f0d 100644 --- a/source/lsarpcd/srv_lsa.c +++ b/source/lsarpcd/srv_lsa.c @@ -35,7 +35,7 @@ extern fstring global_myworkgroup; /*************************************************************************** make_dom_query ***************************************************************************/ -static void make_dom_query(DOM_QUERY * d_q, char *dom_name, DOM_SID * dom_sid) +static void make_dom_query(DOM_QUERY * d_q, char *dom_name, DOM_SID *dom_sid) { fstring sid_str; int domlen = strlen(dom_name); @@ -97,7 +97,7 @@ static void make_reply_lookup_sids(LSA_R_LOOKUP_SIDS * r_l, /*************************************************************************** lsa_reply_lookup_sids ***************************************************************************/ -static BOOL lsa_reply_lookup_sids(LSA_Q_LOOKUP_SIDS * q_l, prs_struct * rdata) +static BOOL lsa_reply_lookup_sids(LSA_Q_LOOKUP_SIDS * q_l, prs_struct *rdata) { LSA_R_LOOKUP_SIDS r_l; DOM_R_REF ref; @@ -125,8 +125,7 @@ static BOOL lsa_reply_lookup_sids(LSA_Q_LOOKUP_SIDS * q_l, prs_struct * rdata) /*************************************************************************** api_lsa_open_policy ***************************************************************************/ -static BOOL api_lsa_open_policy2(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_open_policy2(prs_struct *data, prs_struct *rdata) { LSA_Q_OPEN_POL2 q_o; LSA_R_OPEN_POL2 r_o; @@ -147,8 +146,7 @@ static BOOL api_lsa_open_policy2(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_open_policy ***************************************************************************/ -static BOOL api_lsa_open_policy(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_open_policy(prs_struct *data, prs_struct *rdata) { LSA_Q_OPEN_POL q_o; LSA_R_OPEN_POL r_o; @@ -169,8 +167,7 @@ static BOOL api_lsa_open_policy(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_enum_trust_dom ***************************************************************************/ -static BOOL api_lsa_enum_trust_dom(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_enum_trust_dom(prs_struct *data, prs_struct *rdata) { uint32 status; uint32 enum_context; @@ -211,8 +208,7 @@ static BOOL api_lsa_enum_trust_dom(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_query_info ***************************************************************************/ -static BOOL api_lsa_query_info(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_query_info(prs_struct *data, prs_struct *rdata) { LSA_Q_QUERY_INFO q_i; LSA_R_QUERY_INFO r_i; @@ -250,8 +246,7 @@ static BOOL api_lsa_query_info(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_lookup_sids ***************************************************************************/ -static BOOL api_lsa_lookup_sids(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_lookup_sids(prs_struct *data, prs_struct *rdata) { LSA_Q_LOOKUP_SIDS q_l; ZERO_STRUCT(q_l); @@ -269,8 +264,7 @@ static BOOL api_lsa_lookup_sids(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_lookup_names ***************************************************************************/ -static BOOL api_lsa_lookup_names(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_lookup_names(prs_struct *data, prs_struct *rdata) { LSA_Q_LOOKUP_NAMES q_l; LSA_R_LOOKUP_NAMES r_l; @@ -311,8 +305,7 @@ static BOOL api_lsa_lookup_names(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_close ***************************************************************************/ -static BOOL api_lsa_close(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_close(prs_struct *data, prs_struct *rdata) { LSA_R_CLOSE r_c; LSA_Q_CLOSE q_c; @@ -333,8 +326,7 @@ static BOOL api_lsa_close(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_create_secret ***************************************************************************/ -static BOOL api_lsa_create_secret(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_create_secret(prs_struct *data, prs_struct *rdata) { LSA_R_CREATE_SECRET r_o; LSA_Q_CREATE_SECRET q_o; @@ -356,8 +348,7 @@ static BOOL api_lsa_create_secret(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_set_secret. AGH! HACK! :) ***************************************************************************/ -static BOOL api_lsa_set_secret(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_set_secret(prs_struct *data, prs_struct *rdata) { LSA_Q_SET_SECRET q_o; LSA_R_SET_SECRET r_o; @@ -382,8 +373,7 @@ static BOOL api_lsa_set_secret(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_query_secret. AGH! HACK! :) ***************************************************************************/ -static BOOL api_lsa_query_secret(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_query_secret(prs_struct *data, prs_struct *rdata) { LSA_R_QUERY_SECRET r_o; LSA_Q_QUERY_SECRET q_o; @@ -435,8 +425,7 @@ static BOOL api_lsa_query_secret(rpcsrv_struct * p, prs_struct * data, /*************************************************************************** api_lsa_create_secret ***************************************************************************/ -static BOOL api_lsa_open_secret(rpcsrv_struct * p, prs_struct * data, - prs_struct * rdata) +static BOOL api_lsa_open_secret(prs_struct *data, prs_struct *rdata) { LSA_R_OPEN_SECRET r_o; LSA_Q_OPEN_SECRET q_o; diff --git a/source/msrpc/msrpcd_process.c b/source/msrpc/msrpcd_process.c index 492040e881a..93776aa1777 100644 --- a/source/msrpc/msrpcd_process.c +++ b/source/msrpc/msrpcd_process.c @@ -334,12 +334,22 @@ void add_srv_auth_fn(rpcsrv_struct * l, srv_auth_fns * fn) ****************************************************************************/ BOOL msrpcd_init(int c, rpcsrv_struct ** l) { - vuser_key uk; user_struct *vuser = NULL; + vuser_key uk; + + (*l) = malloc(sizeof(*(*l))); + if ((*l) == NULL) + { + return False; + } + + ZERO_STRUCTP(*l); if (!get_user_creds(c, &uk)) { DEBUG(0, ("authentication failed\n")); + safe_free(*l); + (*l) = NULL; return False; } @@ -347,32 +357,27 @@ BOOL msrpcd_init(int c, rpcsrv_struct ** l) { if (!become_vuser(&uk)) { + safe_free(*l); + (*l) = NULL; return False; } vuser = get_valid_user_struct(&uk); if (vuser == NULL) { + safe_free(*l); + (*l) = NULL; return False; } } else { - if (!become_guest()) - { - return False; - } - } - - (*l) = malloc(sizeof(*(*l))); - if ((*l) == NULL) - { - vuid_free_user_struct(vuser); + safe_free(*l); + (*l) = NULL; return False; } - ZERO_STRUCTP(*l); - + (*l)->initial_pipe_key = uk; (*l)->key = uk; (*l)->c = c; @@ -459,12 +464,13 @@ void msrpcd_process(msrpc_service_fns * fn, rpcsrv_struct * l, return; } +#if 0 if (counter == 0) { /* reload services, if files have changed. */ fn->reload_services(True); } - +#endif /* * If reload_after_sighup == True then we got a SIGHUP * and are being asked to reload. Fix from <branko.cibej@hermes.si> diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c index a2a8d728d9d..28e032cabce 100644 --- a/source/printing/nt_printing.c +++ b/source/printing/nt_printing.c @@ -1290,7 +1290,7 @@ BOOL get_specific_param_by_index(NT_PRINTER_INFO_LEVEL printer, uint32 level, ui param=printer.info_2->specific; - while (param != NULL && i < param_index) + while (param != NULL && i <= param_index) { param=param->next; i++; diff --git a/source/printing/pcap.c b/source/printing/pcap.c index 242406c9748..62010706bb3 100644 --- a/source/printing/pcap.c +++ b/source/printing/pcap.c @@ -9,6 +9,8 @@ Re-written again by Andrew Tridgell Modified for SVID support by Norm Jacobs, 1997 + + Modified for CUPS support by Michael Sweet, 1999 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 @@ -54,6 +56,9 @@ * * Modified to call SVID/XPG4 support if printcap name is set to "lpstat" * in smb.conf under Solaris. + * + * Modified to call CUPS support if printcap name is set to "cups" + * in smb.conf. */ #include "includes.h" @@ -69,7 +74,7 @@ extern int DEBUGLEVEL; ****************************************** */ static int strlocate(char *xpLine,char *xpS) { - int iS,iL,i,iRet; + int iS,iL,iRet; char *p; iS = strlen(xpS); iL = strlen(xpLine); @@ -91,9 +96,9 @@ static int strlocate(char *xpLine,char *xpS) /* ******************************************************************* */ /* * Scan qconfig and search all virtual printer (device printer) * */ /* ******************************************************************* */ -static void ScanQconfig_fn(char *psz,void (*fn)()) +static void ScanQconfig_fn(char *psz,void (*fn)(char *, char *)) { - int iLg,iEtat; + int iEtat; FILE *pfile; char *line,*p; pstring name,comment; @@ -262,6 +267,11 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) return(False); } +#ifdef HAVE_LIBCUPS + if (strequal(psz, "cups")) + return (cups_printername_ok(pszPrintername)); +#endif /* HAVE_LIBCUPS */ + #ifdef SYSV if (strequal(psz, "lpstat")) return (sysv_printername_ok(pszPrintername)); @@ -329,6 +339,13 @@ void pcap_printer_fn(void (*fn)(char *, char *)) return; } +#ifdef HAVE_LIBCUPS + if (strequal(psz, "cups")) { + cups_printer_fn(fn); + return; + } +#endif /* HAVE_LIBCUPS */ + #ifdef SYSV if (strequal(psz, "lpstat")) { sysv_printer_fn(fn); diff --git a/source/printing/print_svid.c b/source/printing/print_svid.c index 5c5eebeb502..21e8eeb6439 100644 --- a/source/printing/print_svid.c +++ b/source/printing/print_svid.c @@ -49,7 +49,7 @@ static void populate_printers(void) { FILE *fp; - if ((fp = popen("/usr/bin/lpstat -v", "r")) != NULL) { + if ((fp = sys_popen("/usr/bin/lpstat -v", "r", False)) != NULL) { char buf[BUFSIZ]; while (fgets(buf, sizeof (buf), fp) != NULL) { @@ -60,7 +60,17 @@ static void populate_printers(void) if (((tmp = strchr(buf, ' ')) == NULL) || ((tmp = strchr(++tmp, ' ')) == NULL)) continue; - name = ++tmp; + + /* + * In case we're only at the "for ". + */ + + if(!strncmp("for ",++tmp,4)) + { + tmp=strchr(tmp, ' '); + tmp++; + } + name = tmp; /* truncate the ": ..." */ if ((tmp = strchr(name, ':')) != NULL) @@ -69,12 +79,15 @@ static void populate_printers(void) /* add it to the cache */ if ((ptmp = malloc(sizeof (*ptmp))) != NULL) { ZERO_STRUCTP(ptmp); - ptmp->name = strdup(name); + if((ptmp->name = strdup(name)) == NULL) + DEBUG(0,("populate_printers: malloc fail in strdup !\n")); ptmp->next = printers; printers = ptmp; + } else { + DEBUG(0,("populate_printers: malloc fail for ptmp\n")); } } - pclose(fp); + sys_pclose(fp); } else { DEBUG(0,( "Unable to run lpstat!\n")); } diff --git a/source/rpc_parse/parse_prs.c b/source/rpc_parse/parse_prs.c index 56c835b4bf5..eb949669aef 100644 --- a/source/rpc_parse/parse_prs.c +++ b/source/rpc_parse/parse_prs.c @@ -217,7 +217,6 @@ BOOL prs_buf_copy(char *copy_into, const prs_struct * buf, prs_debug_out(bcp, "prs_struct_copy", 200); - /* there's probably an off-by-one bug, here, and i haven't even tested the code :-) */ while (offset < end && ((q = prs_data(bcp, offset)) != NULL)) { uint32 copy_len; diff --git a/source/rpc_server/srv_pipe_noauth.c b/source/rpc_server/srv_pipe_noauth.c index 50140d22390..a0c3261a0f1 100644 --- a/source/rpc_server/srv_pipe_noauth.c +++ b/source/rpc_server/srv_pipe_noauth.c @@ -156,16 +156,17 @@ static BOOL api_noauth_auth_gen(rpcsrv_struct * l, prs_struct *resp, static BOOL api_noauth_auth_chk(rpcsrv_struct * l, enum RPC_PKT_TYPE pkt_type) { - extern uint16 ctx_id_table[65536]; + extern vuser_key ctx_id_table[65536]; const vuser_key *key = get_sec_ctx(); l->auth_validated = True; if (key == NULL) { + DEBUG(5,("api_noauth_auth_chk: no vuser_key\n")); return False; } - ctx_id_table[l->hdr_rb.context_id] = key->vuid; + ctx_id_table[l->hdr_rb.context_id] = *key; return True; } diff --git a/source/rpc_server/srv_pipe_srv.c b/source/rpc_server/srv_pipe_srv.c index 7c6c077c3ee..2088cb8a732 100644 --- a/source/rpc_server/srv_pipe_srv.c +++ b/source/rpc_server/srv_pipe_srv.c @@ -28,7 +28,7 @@ extern int DEBUGLEVEL; -uint16 ctx_id_table[65536]; +vuser_key ctx_id_table[65536]; /******************************************************************* turns a DCE/RPC response stream into a DCE/RPC reply @@ -153,7 +153,9 @@ static BOOL api_pipe_nack_resp(rpcsrv_struct * l, uint16 rej_code, DEBUG(5, ("api_pipe_nack_resp: make response\n")); +#if 0 l->faulted_once_before = True; +#endif prs_init(&(rhdr), 0, 4, False); prs_init(&(rnack), 0, 4, False); @@ -265,19 +267,19 @@ static BOOL srv_pipe_bind_and_alt_req(rpcsrv_struct * l, return False; } - assoc_gid = l->hdr_rb.bba.assoc_gid; - - if (assoc_gid != 0) - { - l->key.pid = assoc_gid; - } - if (l->hdr.auth_len != 0) { RPC_HDR_AUTH auth_info; BOOL found = False; int i; + assoc_gid = l->hdr_rb.bba.assoc_gid; + + if (assoc_gid != 0) + { + l->key.pid = assoc_gid; + } + /* decode the authentication verifier */ smb_io_rpc_hdr_auth("", &auth_info, &l->data_i, 0); if (l->data_i.offset == 0) @@ -305,10 +307,12 @@ static BOOL srv_pipe_bind_and_alt_req(rpcsrv_struct * l, l->auth_info = NULL; assoc_gid = l->hdr_rb.bba.assoc_gid; +#if 0 if (assoc_gid != 0) { l->key.pid = assoc_gid; } +#endif } if (assoc_gid == 0) @@ -573,6 +577,11 @@ static BOOL rpc_redir_local(rpcsrv_struct * l, prs_struct *req, { case RPC_BIND: { + reply = become_vuser(&l->initial_pipe_key); + if (!reply) + { + break; + } reply = api_pipe_bind_req(l, name, resp); if (!reply) { @@ -598,29 +607,23 @@ static BOOL rpc_redir_local(rpcsrv_struct * l, prs_struct *req, { vuser_key key = l->key; /* read the rpc header */ - reply = - smb_io_rpc_hdr_req("req", + reply = smb_io_rpc_hdr_req("req", &(l->hdr_req), &l->data_i, 0); if (reply) { - key.vuid = - ctx_id_table[l-> - hdr_req.context_id]; - reply = become_vuser(&key) - || become_guest(); + key = ctx_id_table[l->hdr_req.context_id]; + reply = become_vuser(&key); } if (reply) { - reply = - api_pipe_request(l, name, + reply = api_pipe_request(l, name, resp); } if (!reply) { - DEBUG(10, - ("dce/rpc request failed\n")); + DEBUG(10, ("dce/rpc request failed\n")); } } break; diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c index 6ffcb2bb566..b6ccbd3f418 100644 --- a/source/smbd/lanman.c +++ b/source/smbd/lanman.c @@ -51,7 +51,6 @@ extern fstring global_sam_name; #define NERR_BufTooSmall (NERR_BASE+23) #define NERR_JobNotFound (NERR_BASE+51) #define NERR_DestNotFound (NERR_BASE+52) -#define ERROR_INVALID_LEVEL 124 #define ACCESS_READ 0x01 #define ACCESS_WRITE 0x02 |