diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-10-11 08:40:42 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-10-11 08:40:42 +0000 |
commit | 8cec5cf35f17568009c70d37bb8b2a1f360d3422 (patch) | |
tree | fa7146c88d50687390a8a909571cc97b96d37485 /source3/utils | |
parent | d5a62df4c569e5f82186900c5770c59a5c384587 (diff) | |
download | samba-8cec5cf35f17568009c70d37bb8b2a1f360d3422.tar.gz samba-8cec5cf35f17568009c70d37bb8b2a1f360d3422.tar.bz2 samba-8cec5cf35f17568009c70d37bb8b2a1f360d3422.zip |
first step in converting the head branch to use lang_tdb.c instead
of gettext for internationalisation support. There is more to do
(This used to be commit ab7f67677a1ade4669e5c2750d0a38422ea616a9)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/smbfilter.c | 52 | ||||
-rw-r--r-- | source3/utils/testparm.c | 5 |
2 files changed, 36 insertions, 21 deletions
diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c index 5c21f22cfd..0707db0e22 100644 --- a/source3/utils/smbfilter.c +++ b/source3/utils/smbfilter.c @@ -26,7 +26,7 @@ #define SECURITY_SET 0 /* this forces non-unicode */ -#define CAPABILITY_MASK (CAP_NT_SMBS | CAP_RPC_REMOTE_APIS) +#define CAPABILITY_MASK 0 #define CAPABILITY_SET 0 /* and non-unicode for the client too */ @@ -36,6 +36,22 @@ static char *netbiosname; static char packet[BUFFER_SIZE]; +static void save_file(const char *fname, void *packet, size_t length) +{ + int fd; + fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (fd == -1) { + perror(fname); + return; + } + if (write(fd, packet, length) != length) { + fprintf(stderr,"Failed to write %s\n", fname); + return; + } + close(fd); + printf("Wrote %d bytes to %s\n", length, fname); +} + static void filter_reply(char *buf) { int msg_type = CVAL(buf,0); @@ -75,8 +91,8 @@ static void filter_request(char *buf) /* session request */ name_extract(buf,4,name1); name_extract(buf,4 + name_len(buf + 4),name2); - DEBUG(0,("sesion_request: %s -> %s\n", - name1, name2)); + d_printf("sesion_request: %s -> %s\n", + name1, name2); if (netbiosname) { /* replace the destination netbios name */ name_mangle(netbiosname, buf+4, 0x20); @@ -90,6 +106,10 @@ static void filter_request(char *buf) case SMBsesssetupX: /* force the client capabilities */ x = IVAL(buf,smb_vwv11); + d_printf("SMBsesssetupX cap=0x%08x\n", x); + d_printf("pwlen=%d/%d\n", SVAL(buf, smb_vwv7), SVAL(buf, smb_vwv8)); + system("mv sessionsetup.dat sessionsetup1.dat"); + save_file("sessionsetup.dat", smb_buf(buf), SVAL(buf, smb_vwv7)); x = (x | CLI_CAPABILITY_SET) & ~CLI_CAPABILITY_MASK; SIVAL(buf, smb_vwv11, x); break; @@ -103,10 +123,10 @@ static void filter_child(int c, struct in_addr dest_ip) int s; /* we have a connection from a new client, now connect to the server */ - s = open_socket_out(SOCK_STREAM, &dest_ip, 139, LONG_CONNECT_TIMEOUT); + s = open_socket_out(SOCK_STREAM, &dest_ip, 445, LONG_CONNECT_TIMEOUT); if (s == -1) { - DEBUG(0,("Unable to connect to %s\n", inet_ntoa(dest_ip))); + d_printf("Unable to connect to %s\n", inet_ntoa(dest_ip)); exit(1); } @@ -123,28 +143,28 @@ static void filter_child(int c, struct in_addr dest_ip) if (c != -1 && FD_ISSET(c, &fds)) { if (!receive_smb(c, packet, 0)) { - DEBUG(0,("client closed connection\n")); + d_printf("client closed connection\n"); exit(0); } filter_request(packet); if (!send_smb(s, packet)) { - DEBUG(0,("server is dead\n")); + d_printf("server is dead\n"); exit(1); } } if (s != -1 && FD_ISSET(s, &fds)) { if (!receive_smb(s, packet, 0)) { - DEBUG(0,("server closed connection\n")); + d_printf("server closed connection\n"); exit(0); } filter_reply(packet); if (!send_smb(c, packet)) { - DEBUG(0,("client is dead\n")); + d_printf("client is dead\n"); exit(1); } } } - DEBUG(0,("Connection closed\n")); + d_printf("Connection closed\n"); exit(0); } @@ -156,20 +176,20 @@ static void start_filter(char *desthost) CatchChild(); - /* start listening on port 139 locally */ - s = open_socket_in(SOCK_STREAM, 139, 0, 0, True); + /* start listening on port 445 locally */ + s = open_socket_in(SOCK_STREAM, 445, 0, 0, True); if (s == -1) { - DEBUG(0,("bind failed\n")); + d_printf("bind failed\n"); exit(1); } if (listen(s, 5) == -1) { - DEBUG(0,("listen failed\n")); + d_printf("listen failed\n"); } if (!resolve_name(desthost, &dest_ip, 0x20)) { - DEBUG(0,("Unable to resolve host %s\n", desthost)); + d_printf("Unable to resolve host %s\n", desthost); exit(1); } @@ -221,7 +241,7 @@ int main(int argc, char *argv[]) } if (!lp_load(configfile,True,False,False)) { - DEBUG(0,("Unable to load config file\n")); + d_printf("Unable to load config file\n"); } start_filter(desthost); diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 9397ea2520..09948b8635 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -157,11 +157,6 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_ } } - if (lp_status(-1) && lp_max_smbd_processes()) { - printf("ERROR: the 'max smbd processes' parameter is set and the 'status' parameter is set to 'no'.\n"); - ret = 1; - } - return ret; } |