1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

nttrans.c:

winreg was missing from the list of pipes.  advise using the array
already defined in... rpc_parse/parse_rpc.c's pipe_names[], but
writing code to strip "\PIPE\" from the front when making the
check.

one location to update when adding new pipes, not two.


srv_pipe_hnd.c:

moved the ZERO_STRUCT(p) macro to _before_ the DLIST_ADD(Pipes, p) macro.

dlinklist.h:

added { }s around the code inserted by DLIST_ADD and DLIST_REMOVE macros
(This used to be commit 29201d4b9b)
This commit is contained in:
Luke Leighton 1998-09-23 21:49:09 +00:00
parent 0e091a5207
commit 500a474aae
3 changed files with 35 additions and 6 deletions

View File

@ -25,6 +25,7 @@
/* hook into the front of the list */ /* hook into the front of the list */
#define DLIST_ADD(list, p) \ #define DLIST_ADD(list, p) \
{ \
if (!(list)) { \ if (!(list)) { \
(list) = (p); \ (list) = (p); \
(p)->next = (p)->prev = NULL; \ (p)->next = (p)->prev = NULL; \
@ -33,18 +34,21 @@
(p)->next = (list); \ (p)->next = (list); \
(p)->prev = NULL; \ (p)->prev = NULL; \
(list) = (p); \ (list) = (p); \
} }\
}
/* remove an element from a list */ /* remove an element from a list */
#define DLIST_REMOVE(list, p) \ #define DLIST_REMOVE(list, p) \
{ \
if ((p) == (list)) { \ if ((p) == (list)) { \
(list) = (p)->next; \ (list) = (p)->next; \
if (list) (list)->prev = NULL; \ if (list) (list)->prev = NULL; \
} else { \ } else { \
(p)->prev->next = (p)->next; \ (p)->prev->next = (p)->next; \
if ((p)->next) (p)->next->prev = (p)->prev; \ if ((p)->next) (p)->next->prev = (p)->prev; \
} } \
}
/* promote an element to the top of the list */ /* promote an element to the top of the list */
#define DLIST_PROMOTE(list, p) \ #define DLIST_PROMOTE(list, p) \

View File

@ -72,6 +72,9 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
pipes_struct *p; pipes_struct *p;
static int next_pipe; static int next_pipe;
DEBUG(4,("Open pipe requested %s (pipes_open=%d)\n",
pipe_name, pipes_open));
/* not repeating pipe numbers makes it easier to track things in /* not repeating pipe numbers makes it easier to track things in
log files and prevents client bugs where pipe numbers are reused log files and prevents client bugs where pipe numbers are reused
over connection restarts */ over connection restarts */
@ -88,9 +91,15 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
next_pipe = (i+1) % MAX_OPEN_PIPES; next_pipe = (i+1) % MAX_OPEN_PIPES;
for (p = Pipes; p; p = p->next)
{
DEBUG(5,("open pipes: name %s pnum=%x\n", p->name, p->pnum));
}
p = (pipes_struct *)malloc(sizeof(*p)); p = (pipes_struct *)malloc(sizeof(*p));
if (!p) return NULL; if (!p) return NULL;
ZERO_STRUCTP(p);
DLIST_ADD(Pipes, p); DLIST_ADD(Pipes, p);
bitmap_set(bmap, i); bitmap_set(bmap, i);
@ -98,7 +107,6 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
pipes_open++; pipes_open++;
ZERO_STRUCTP(p);
p->pnum = i; p->pnum = i;
p->open = True; p->open = True;
@ -123,7 +131,13 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
chain_p = p; chain_p = p;
return p; /* OVERWRITE p as a temp variable, to display all open pipes */
for (p = Pipes; p; p = p->next)
{
DEBUG(5,("open pipes: name %s pnum=%x\n", p->name, p->pnum));
}
return chain_p;
} }
@ -304,8 +318,18 @@ pipes_struct *get_rpc_pipe(int pnum)
{ {
pipes_struct *p; pipes_struct *p;
for (p=Pipes;p;p=p->next) { DEBUG(4,("search for pipe pnum=%x\n", pnum));
if (p->pnum == pnum) {
for (p=Pipes;p;p=p->next)
{
DEBUG(5,("pipe name %s pnum=%x (pipes_open=%d)\n",
p->name, p->pnum, pipes_open));
}
for (p=Pipes;p;p=p->next)
{
if (p->pnum == pnum)
{
chain_p = p; chain_p = p;
return p; return p;
} }

View File

@ -44,6 +44,7 @@ static char *known_nt_pipes[] = {
"\\ntsvcs", "\\ntsvcs",
"\\lsass", "\\lsass",
"\\lsarpc", "\\lsarpc",
"\\winreg",
NULL NULL
}; };