diff options
author | Luke Leighton <lkcl@samba.org> | 2000-05-27 09:19:57 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 2000-05-27 09:19:57 +0000 |
commit | 712a30ed51ca2b58e00d38a5d6d70d564b1da11b (patch) | |
tree | 459caacb9a440f85d8f318838638f0ab36d4dbd6 /source3/smbd/process.c | |
parent | 2f3dbeff6f555de91f772eeb1cfda86d80f35928 (diff) | |
download | samba-712a30ed51ca2b58e00d38a5d6d70d564b1da11b.tar.gz samba-712a30ed51ca2b58e00d38a5d6d70d564b1da11b.tar.bz2 samba-712a30ed51ca2b58e00d38a5d6d70d564b1da11b.zip |
prs_give_memory in wrong place, also poss. was losing mem.
(This used to be commit 9805e17cd0ce427c329a8b5a8318d5f75227e283)
Diffstat (limited to 'source3/smbd/process.c')
-rw-r--r-- | source3/smbd/process.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 9e5b7b1477..74ec3b64db 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -408,6 +408,29 @@ struct smb_message_struct {SMBgetmac,"SMBgetmac",NULL,AS_GUEST} }; +/******************************************************************* +dump a prs to a file + ********************************************************************/ +static void smb_dump(char *name, int type, char *data, ssize_t len) +{ + int fd, i; + pstring fname; + if (DEBUGLEVEL < 50) return; + + if (len < 4) len = smb_buflen(data); + for (i=1;i<100;i++) { + slprintf(fname,sizeof(fname), "/tmp/%s.%d.%s", name, i, + type ? "req" : "resp"); + fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); + if (fd != -1 || errno != EEXIST) break; + } + if (fd != -1) { + write(fd, data, len); + close(fd); + DEBUG(0,("created %s len %d\n", fname, len)); + } +} + /**************************************************************************** do a switch on the message type, and return the response size @@ -445,12 +468,14 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize if (match == num_smb_messages) { DEBUG(0,("Unknown message type %d!\n",type)); + smb_dump("Unknown", 1, inbuf, size); outsize = reply_unknown(inbuf,outbuf); } else { DEBUG(3,("switch message %s (pid %d)\n",smb_messages[match].name,(int)pid)); + smb_dump(smb_messages[match].name, 1, inbuf, size); if(global_oplock_break) { int flags = smb_messages[match].flags; @@ -548,6 +573,8 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize } } + smb_dump(smb_messages[match].name, 0, outbuf, outsize); + return(outsize); } |