diff options
author | Luke Leighton <lkcl@samba.org> | 2000-01-03 19:19:48 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 2000-01-03 19:19:48 +0000 |
commit | fbd17c8dafeefac788f4bc1c41045726825f513f (patch) | |
tree | 93aea0a144e9f649d32d7340e12ec9965aab6825 /source3/smbd | |
parent | 632b4f806eae15e319b8f62caef5d25634cf720c (diff) | |
download | samba-fbd17c8dafeefac788f4bc1c41045726825f513f.tar.gz samba-fbd17c8dafeefac788f4bc1c41045726825f513f.tar.bz2 samba-fbd17c8dafeefac788f4bc1c41045726825f513f.zip |
simple mods to add msrpc pipe redirection. default behaviour: fall back
to using internal msrpc code in smbd.
(This used to be commit 8976e26d46cb991710bc77463f7f928ac00dd4d8)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/ipc.c | 31 | ||||
-rw-r--r-- | source3/smbd/pipes.c | 20 | ||||
-rw-r--r-- | source3/smbd/server.c | 25 |
3 files changed, 63 insertions, 13 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 4e9418fa94..cb4127aee4 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -3154,11 +3154,20 @@ static BOOL api_WPrintPortEnum(connection_struct *conn,uint16 vuid, char *param, Start the first part of an RPC reply which began with an SMBtrans request. ****************************************************************************/ -static BOOL api_rpc_trans_reply(char *outbuf, pipes_struct *p) +static BOOL api_rpc_trans_reply(char *outbuf, pipes_struct *p, + char *redir_data, int redir_len) { - char *rdata = malloc(p->max_trans_reply); + char *rdata; int data_len; + if (redir_data != NULL) + { + send_trans_reply(outbuf, NULL, 0, redir_data, redir_len, + redir_len > p->max_trans_reply); + return True; + } + + rdata = malloc(p->max_trans_reply); if(rdata == NULL) { DEBUG(0,("api_rpc_trans_reply: malloc fail.\n")); return False; @@ -3284,11 +3293,23 @@ static int api_fd_reply(connection_struct *conn,uint16 vuid,char *outbuf, switch (subcommand) { case 0x26: - /* dce/rpc command */ - reply = rpc_command(p, data, tdscnt); + { + char *rdata = NULL; + int rlen = mdrcnt; + + if (p->m) + { + reply = readwrite_pipe(p, data, tdscnt, &rdata, &rlen); + } + else + { + /* dce/rpc command */ + reply = rpc_command(p, data, tdscnt); + } if (reply) - reply = api_rpc_trans_reply(outbuf, p); + reply = api_rpc_trans_reply(outbuf, p, rdata, rlen); break; + } case 0x53: /* Wait Named Pipe Handle state */ reply = api_WNPHS(outbuf, p, params, tpscnt); diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 15f52c0af6..1a9ac1d7a4 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -129,7 +129,16 @@ int reply_pipe_write(char *inbuf,char *outbuf,int length,int dum_bufsize) if (numtowrite == 0) nwritten = 0; else - nwritten = write_to_pipe(p, data, numtowrite); + { + if (p->m != NULL) + { + nwritten = write_pipe(p, data, numtowrite); + } + else + { + nwritten = write_to_pipe(p, data, numtowrite); + } + } if ((nwritten == 0 && numtowrite != 0) || (nwritten < 0)) return (UNIXERROR(ERRDOS,ERRnoaccess)); @@ -207,7 +216,14 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize) set_message(outbuf,12,0,True); data = smb_buf(outbuf); - nread = read_from_pipe(p, data, smb_maxcnt); + if (p->m != NULL) + { + nread = read_pipe(p, data, smb_maxcnt); + } + else + { + nread = read_from_pipe(p, data, smb_maxcnt); + } if (nread < 0) return(UNIXERROR(ERRDOS,ERRnoaccess)); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 0d45f11693..716f555c65 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -501,6 +501,8 @@ static void usage(char *pname) ****************************************************************************/ int main(int argc,char *argv[]) { + fstring sam_name; + extern BOOL append_log; /* shall I run as a daemon */ BOOL is_daemon = False; @@ -680,11 +682,6 @@ static void usage(char *pname) fstrcpy(global_myworkgroup, lp_workgroup()); - if(!pdb_generate_sam_sid()) { - DEBUG(0,("ERROR: Samba cannot create a SAM SID.\n")); - exit(1); - } - CatchSignal(SIGHUP,SIGNAL_CAST sig_hup); /* Setup the signals that allow the debug log level @@ -734,7 +731,23 @@ static void usage(char *pname) /* possibly reload the services file. */ reload_services(True); - + + /* obtain or create a SAM SID */ + if (lp_domain_logons()) + { + fstrcpy(sam_name, global_myworkgroup); + } + else + { + fstrcpy(sam_name, global_myname); + } + + if(!pdb_generate_sam_sid(sam_name, NULL)) + { + DEBUG(0,("ERROR: Samba cannot create a SAM SID.\n")); + exit(1); + } + if (*lp_rootdir()) { if (sys_chroot(lp_rootdir()) == 0) DEBUG(2,("Changed root to %s\n", lp_rootdir())); |