const char *srv,
const struct ndr_syntax_id *interface,
const struct api_struct *cmds, int size);
+bool is_known_pipename(const char *cli_filename);
bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p);
bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p);
bool api_pipe_ntlmssp_auth_process(pipes_struct *p, prs_struct *rpc_in,
return NT_STATUS_OK;
}
+/**
+ * Is a named pipe known?
+ * @param[in] cli_filename The pipe name requested by the client
+ * @result Do we want to serve this?
+ */
+bool is_known_pipename(const char *cli_filename)
+{
+ const char *pipename = cli_filename;
+ int i;
+
+ if (strnequal(pipename, "\\PIPE\\", 6)) {
+ pipename += 5;
+ }
+
+ if (*pipename == '\\') {
+ pipename += 1;
+ }
+
+ if (lp_disable_spoolss() && strequal(pipename, "spoolss")) {
+ DEBUG(10, ("refusing spoolss access\n"));
+ return false;
+ }
+
+ for (i=0; i<rpc_lookup_size; i++) {
+ if (strequal(pipename, rpc_lookup[i].pipe.clnt)) {
+ return true;
+ }
+ }
+
+ DEBUG(10, ("is_known_pipename: %s unknown\n", cli_filename));
+ return false;
+}
+
/*******************************************************************
Handle a SPNEGO krb5 bind auth.
*******************************************************************/
extern int max_send;
extern enum protocol_types Protocol;
-static const char *known_nt_pipes[] = {
- "\\LANMAN",
- "\\srvsvc",
- "\\samr",
- "\\wkssvc",
- "\\NETLOGON",
- "\\ntlsa",
- "\\ntsvcs",
- "\\lsass",
- "\\lsarpc",
- "\\winreg",
- "\\initshutdown",
- "\\spoolss",
- "\\netdfs",
- "\\rpcecho",
- "\\svcctl",
- "\\eventlog",
- "\\unixinfo",
- NULL
-};
-
static char *nttrans_realloc(char **ptr, size_t size)
{
if (ptr==NULL) {
struct smb_request *req, int *ppnum)
{
smb_np_struct *p = NULL;
- int i;
DEBUG(4,("nt_open_pipe: Opening pipe %s.\n", fname));
/* See if it is one we want to handle. */
- if (lp_disable_spoolss() && strequal(fname, "\\spoolss")) {
- reply_botherror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND,
- ERRDOS, ERRbadpipe);
- return;
- }
-
- for( i = 0; known_nt_pipes[i]; i++ ) {
- if( strequal(fname,known_nt_pipes[i])) {
- break;
- }
- }
-
- if ( known_nt_pipes[i] == NULL ) {
+ if (!is_known_pipename(fname)) {
reply_botherror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND,
ERRDOS, ERRbadpipe);
return;
fstring user;
};
-
-extern struct pipe_id_info pipe_names[];
-
/****************************************************************************
Reply to an open and X on a named pipe.
This code is basically stolen from reply_open_and_X with some
char *pipe_name = NULL;
smb_np_struct *p;
int size=0,fmode=0,mtime=0,rmode=0;
- int i;
TALLOC_CTX *ctx = talloc_tos();
/* XXXX we need to handle passed times, sattr and flags */
DEBUG(4,("Opening pipe %s.\n", pipe_name));
/* See if it is one we want to handle. */
- for( i = 0; pipe_names[i].client_pipe ; i++ ) {
- if( strequal(pipe_name,pipe_names[i].client_pipe)) {
- break;
- }
- }
-
- if (pipe_names[i].client_pipe == NULL) {
+ if (!is_known_pipename(pipe_name)) {
reply_botherror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND,
ERRDOS, ERRbadpipe);
return;