diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-07-01 09:05:10 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:02 -0500 |
commit | fe94ba6e71eb8d3273d593763f6b6d03fa90113d (patch) | |
tree | cc1076eb2a6edfbe80dda981d627835ffc8bc1f1 /source4/rpc_server/spoolss | |
parent | cee17efc7c3897182765d457cce98043f7a7b94f (diff) | |
download | samba-fe94ba6e71eb8d3273d593763f6b6d03fa90113d.tar.gz samba-fe94ba6e71eb8d3273d593763f6b6d03fa90113d.tar.bz2 samba-fe94ba6e71eb8d3273d593763f6b6d03fa90113d.zip |
r8046: - add somemore failure checks in the RPC-SPOOLSS test
- test AddForm on the PrintServer object
- GetForm() isn't allowed on the PrintServer object so remove NTPTR
function for it
- accept the dns name as servername in the spoolss server
metze
(This used to be commit d8c308a4653d59514915021607fe55c5f2b38749)
Diffstat (limited to 'source4/rpc_server/spoolss')
-rw-r--r-- | source4/rpc_server/spoolss/dcesrv_spoolss.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index f8a0ab5efa..dfa935b750 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -144,28 +144,50 @@ static WERROR spoolss_check_server_name(struct dcesrv_call_state *dce_call, const char *server_name) { BOOL ret; - const char *ip_str; + char *str; + /* NULL is ok */ if (!server_name) return WERR_OK; + /* "" is ok */ ret = strequal("",server_name); if (ret) return WERR_OK; + /* just "\\" is invalid */ + if (strequal("\\\\", server_name)) { + return WERR_INVALID_PRINTER_NAME; + } + + /* then we need "\\" */ if (strncmp("\\\\", server_name, 2) != 0) { return WERR_INVALID_PRINTER_NAME; } server_name += 2; + /* NETBIOS NAME is ok */ ret = strequal(lp_netbios_name(), server_name); if (ret) return WERR_OK; - /* TODO: check dns name here ? */ + /* DNS NAME is ok + * TODO: we need to check if aliases are also ok + */ + if (lp_realm() != NULL) { + str = talloc_asprintf(mem_ctx, "%s.%s", + lp_netbios_name(), + lp_realm()); + W_ERROR_HAVE_NO_MEMORY(str); + + ret = strequal(str, server_name); + talloc_free(str); + if (ret) return WERR_OK; + } - ip_str = socket_get_my_addr(dce_call->conn->srv_conn->socket, mem_ctx); - W_ERROR_HAVE_NO_MEMORY(ip_str); + str = socket_get_my_addr(dce_call->conn->srv_conn->socket, mem_ctx); + W_ERROR_HAVE_NO_MEMORY(str); - ret = strequal(ip_str, server_name); + ret = strequal(str, server_name); + talloc_free(str); if (ret) return WERR_OK; return WERR_INVALID_PRINTER_NAME; @@ -650,9 +672,10 @@ static WERROR spoolss_GetForm(struct dcesrv_call_state *dce_call, TALLOC_CTX *me switch (handle->type) { case NTPTR_HANDLE_SERVER: - status = ntptr_GetPrintServerForm(handle, mem_ctx, r); - W_ERROR_NOT_OK_RETURN(status); - break; + /* + * stupid, but w2k3 returns WERR_BADFID here? + */ + return WERR_BADFID; case NTPTR_HANDLE_PRINTER: status = ntptr_GetPrinterForm(handle, mem_ctx, r); W_ERROR_NOT_OK_RETURN(status); |