charcnv.c: Russian language updates.
chgpasswd.c: Fixed change password from NT.
ipc.c: Warning fixes, fixed change password from NT.
nmbd.c: Allowed compile with MEM_MAN and SIGUSR1.
nmbd_browsesync.c: Fix for source nbt type.
nmbd_packets.c: Fix for source nbt type.
print_svid.c: lp output processing fix.
printing.c: lprng fix.
reply.c, server.c, util.c : oplock deadlock bugfix.
smbdes.c: Fixed change password from NT.
smbpass.c: Fixed change password from NT.
make_printerdef.c: Fixed warning messages from gcc with assignment in if.
This is the merge of what is in the main branch
to the 1.9.18 branch to get ready for 1.9.18p2.
Note that if Andrew requests we will roll back
the (C) changes.
Jeremy.
/*
some simple CGI helper routines
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB client
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB client
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Tar Extensions
- Copyright (C) Ricky Poulten 1995-1997
+ Copyright (C) Ricky Poulten 1995-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Version 1.9.
NT Domain Authentication SMB / MSRPC client
Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1996-1997
+ Copyright (C) Luke Kenneth Casson Leighton 1996-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*
* smbmount.c
*
- * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
+ * Copyright (C) 1995-1998 by Paal-Kr. Engstad and Volker Lendecke
*
*/
Unix SMB/Netbios implementation.
Version 1.9.
SMB client
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*
* smbumount.c
*
- * Copyright (C) 1995 by Volker Lendecke
+ * Copyright (C) 1995-1998 by Volker Lendecke
*
*/
Unix SMB/Netbios implementation.
Version 1.9.
SMB Byte handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Character set handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Machine customisation and include handling
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Kanji Extensions
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios header - version 2
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence);
BOOL chgpasswd(char *name,char *oldpass,char *newpass);
BOOL chgpasswd(char *name,char *oldpass,char *newpass);
+BOOL check_lanman_password(char *user, unsigned char *pass1,
+ unsigned char *pass2, struct smb_passwd **psmbpw);
+BOOL change_lanman_password(struct smb_passwd *smbpw, char *pass1, char *pass2);
/*The following definitions come from client.c */
BOOL check_name(char *name,int cnum);
void sync_file(int fnum);
void close_file(int fnum, BOOL normal_close);
-BOOL check_file_sharing(int cnum,char *fname);
+BOOL check_file_sharing(int cnum,char *fname, BOOL rename_op);
int check_share_mode( share_mode_entry *share, int deny_mode, char *fname,
BOOL fcbopen, int *flags);
void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
void E_P16(unsigned char *p14,unsigned char *p16);
void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
+void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key);
void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key);
BOOL receive_smb(int fd,char *buffer, int timeout);
BOOL client_receive_smb(int fd,char *buffer, int timeout);
BOOL receive_local_message(int fd, char *buffer, int buffer_len, int timeout);
-BOOL push_local_message(char *buf, int msg_len);
+BOOL push_smb_message(char *buf, int msg_len);
BOOL receive_message_or_smb(int smbfd, int oplock_fd,
char *buffer, int buffer_len,
int timeout, BOOL *got_smb);
Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
- Copyright (C) Andrew Tridgell 1992-1997
- Copyright (C) John H Terpstra 1996-1997
- Copyright (C) Luke Kenneth Casson Leighton 1996-1997
- Copyright (C) Paul Ashton 1997
+ Copyright (C) Andrew Tridgell 1992-1998
+ Copyright (C) John H Terpstra 1996-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1996-1998
+ Copyright (C) Paul Ashton 1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB transaction2 handling
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Jeremy Allison 1994-1998
Extensively modified by Andrew Tridgell, 1995
Unix SMB/Netbios implementation.
Version 1.9.
Character set conversion Extensions
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
update_map("\274\253\277\276");
}
+/* Init for russian language (iso8859-5) */
+
+/* Added by Max Khon <max@iclub.nsu.ru> */
+
+static void init_iso8859_5()
+{
+ int i;
+ if (!mapsinited) initmaps();
+
+ /* Do not map undefined characters to some accidental code */
+ for (i = 128; i < 256; i++)
+ {
+ unix2dos[i] = CTRLZ;
+ dos2unix[i] = CTRLZ;
+ }
+
+/* MSDOS Code Page 866 -> ISO8859-5 */
+update_map("\200\260\201\261\202\262\203\263\204\264\205\265\206\266\207\267");
+update_map("\210\270\211\271\212\272\213\273\214\274\215\275\216\276\217\277");
+update_map("\220\300\221\301\222\302\223\303\224\304\225\305\226\306\227\307");
+update_map("\230\310\231\311\232\312\233\313\234\314\235\315\236\316\237\317");
+update_map("\240\320\241\321\242\322\243\323\244\324\245\325\246\326\247\327");
+update_map("\250\330\251\331\252\332\253\333\254\334\255\335\256\336\257\337");
+update_map("\340\340\341\341\342\342\343\343\344\344\345\345\346\346\347\347");
+update_map("\350\350\351\351\352\352\353\353\354\354\355\355\356\356\357\357");
+update_map("\360\241\361\361\362\244\363\364\364\247\365\367\366\256\367\376");
+update_map("\374\360\377\240");
+}
+
+/* Init for russian language (koi8) */
+
+static void init_koi8_r()
+{
+ if (!mapsinited) initmaps();
+
+ /* There aren't undefined characters between 128 and 255 */
+
+/* MSDOS Code Page 866 -> KOI8-R */
+update_map("\200\304\201\263\202\332\203\277\204\300\205\331\206\303\207\264");
+update_map("\210\302\211\301\212\305\213\337\214\334\215\333\216\335\217\336");
+update_map("\220\260\221\261\222\262\223\364\224\376\225\371\226\373\227\367");
+update_map("\230\363\231\362\232\377\233\365\234\370\235\375\236\372\237\366");
+update_map("\240\315\241\272\242\325\243\361\244\326\245\311\246\270\247\267");
+update_map("\250\273\251\324\252\323\253\310\254\276\255\275\256\274\257\306");
+update_map("\260\307\261\314\262\265\263\360\264\266\265\271\266\321\267\322");
+update_map("\270\313\271\317\272\320\273\312\274\330\275\327\276\316\277\374");
+update_map("\300\356\301\240\302\241\303\346\304\244\305\245\306\344\307\243");
+update_map("\310\345\311\250\312\251\313\252\314\253\315\254\316\255\317\256");
+update_map("\320\257\321\357\322\340\323\341\324\342\325\343\326\246\327\242");
+update_map("\330\354\331\353\332\247\333\350\334\355\335\351\336\347\337\352");
+update_map("\340\236\341\200\342\201\343\226\344\204\345\205\346\224\347\203");
+update_map("\350\225\351\210\352\211\353\212\354\213\355\214\356\215\357\216");
+update_map("\360\217\361\237\362\220\363\221\364\222\365\223\366\206\367\202");
+update_map("\370\234\371\233\372\207\373\230\374\235\375\231\376\227\377\232");
+}
+
/*
* Convert unix to dos
*/
init_iso8859_1();
} else if (strequal (str, "iso8859-2")) {
init_iso8859_2();
+ } else if (strequal (str, "iso8859-5")) {
+ init_iso8859_5();
+ } else if (strequal (str, "koi8-r")) {
+ init_koi8_r();
} else {
DEBUG(0,("unrecognized character set\n"));
}
Unix SMB/Netbios implementation.
Version 1.9.
Character set handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Critical Fault handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-/* Copyright (C) 1992-1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Unix SMB/Netbios implementation.
Version 1.9.
multiple interface handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Kanji Extensions
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
a implementation of MD4 designed for use in the SMB authentication protocol
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
replacement routines for broken systems
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Samba system utilities
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
time handling functions
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*
* UFC-crypt: ultra fast crypt(3) implementation
*
- * Copyright (C) 1991-1997, Free Software Foundation, Inc.
+ * Copyright (C) 1991-1998, Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
Unix SMB/Netbios implementation.
Version 1.9.
Username handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Samba utility functions
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
/****************************************************************************
- structure to hold a linked list of local udp messages.
+ structure to hold a linked list of local messages.
for processing.
****************************************************************************/
-typedef struct _udp_message_list {
- struct _udp_message_list *msg_next;
+typedef struct _message_list {
+ struct _message_list *msg_next;
char *msg_buf;
int msg_len;
-} udp_message_list;
+} pending_message_list;
-static udp_message_list *udp_msg_head = NULL;
+static pending_message_list *smb_msg_head = NULL;
/****************************************************************************
- Function to push a linked list of local udp messages ready
+ Function to push a linked list of local messages ready
for processing.
****************************************************************************/
-BOOL push_local_message(char *buf, int msg_len)
+
+static BOOL push_local_message(pending_message_list **pml, char *buf, int msg_len)
{
- udp_message_list *msg = (udp_message_list *)malloc(sizeof(udp_message_list));
+ pending_message_list *msg = (pending_message_list *)
+ malloc(sizeof(pending_message_list));
if(msg == NULL)
{
- DEBUG(0,("push_local_message: malloc fail (1)\n"));
+ DEBUG(0,("push_message: malloc fail (1)\n"));
return False;
}
memcpy(msg->msg_buf, buf, msg_len);
msg->msg_len = msg_len;
- msg->msg_next = udp_msg_head;
- udp_msg_head = msg;
+ msg->msg_next = *pml;
+ *pml = msg;
return True;
}
+/****************************************************************************
+ Function to push a linked list of local smb messages ready
+ for processing.
+****************************************************************************/
+
+BOOL push_smb_message(char *buf, int msg_len)
+{
+ return push_local_message(&smb_msg_head, buf, msg_len);
+}
+
/****************************************************************************
Do a select on an two fd's - with timeout.
queue (this can only happen during oplock break
processing) return this first.
+ If a pending smb message has been pushed onto the
+ queue (this can only happen during oplock break
+ processing) return this next.
+
If the first smbfd is ready then read an smb from it.
if the second (loopback UDP) fd is ready then read a message
from it and setup the buffer header to identify the length
*got_smb = False;
/*
- * Check to see if we already have a message on the udp queue.
+ * Check to see if we already have a message on the smb queue.
* If so - copy and return it.
*/
-
- if(udp_msg_head)
+
+ if(smb_msg_head)
{
- udp_message_list *msg = udp_msg_head;
+ pending_message_list *msg = smb_msg_head;
memcpy(buffer, msg->msg_buf, MIN(buffer_len, msg->msg_len));
- udp_msg_head = msg->msg_next;
-
+ smb_msg_head = msg->msg_next;
+
/* Free the message we just copied. */
free((char *)msg->msg_buf);
free((char *)msg);
+ *got_smb = True;
+
+ DEBUG(5,("receive_message_or_smb: returning queued smb message.\n"));
return True;
}
home_server_len = sizeof(pstring);
}
strncpy(server_name, nis_result, home_server_len);
+ server_name[home_server_len] = '\0';
}
#else
/* use the local machine name instead of the auto-map server */
Unix SMB/Netbios implementation.
Version 1.9.
SMB client generic functions
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
code to manipulate domain credentials
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
name query routines
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios library routines
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
a partial implementation of DES designed for use in the
SMB authentication protocol
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
out[i] = in1[i] ^ in2[i];
}
-static void dohash(char *out, char *in, char *key)
+static void dohash(char *out, char *in, char *key, int forw)
{
int i, j, k;
char pk1[56];
permute(er, r, perm4, 48);
- xor(erk, er, ki[i], 48);
+ xor(erk, er, ki[forw ? i : 15 - i], 48);
for (j=0;j<8;j++)
for (k=0;k<6;k++)
}
-static void smbhash(unsigned char *out, unsigned char *in, unsigned char *key)
+static void smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
{
int i;
char outb[64];
outb[i] = 0;
}
- dohash(outb, inb, keyb);
+ dohash(outb, inb, keyb, forw);
for (i=0;i<8;i++) {
out[i] = 0;
void E_P16(unsigned char *p14,unsigned char *p16)
{
unsigned char sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
- smbhash(p16, sp8, p14);
- smbhash(p16+8, sp8, p14+7);
+ smbhash(p16, sp8, p14, 1);
+ smbhash(p16+8, sp8, p14+7, 1);
}
void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24)
{
- smbhash(p24, c8, p21);
- smbhash(p24+8, c8, p21+7);
- smbhash(p24+16, c8, p21+14);
+ smbhash(p24, c8, p21, 1);
+ smbhash(p24+8, c8, p21+7, 1);
+ smbhash(p24+16, c8, p21+14, 1);
+}
+
+void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out)
+{
+ smbhash(out, in, p14, 0);
+ smbhash(out+8, in+8, p14+7, 0);
}
void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key)
{
unsigned char buf[8];
- smbhash(buf, in, key);
- smbhash(out, buf, key+9);
+ smbhash(buf, in, key, 1);
+ smbhash(out, buf, key+9, 1);
}
void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key)
unsigned char buf[8];
static unsigned char key2[8];
- smbhash(buf, in, key);
+ smbhash(buf, in, key, 1);
key2[0] = key[7];
- smbhash(out, buf, key2);
+ smbhash(out, buf, key2, 1);
}
Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
Modified by Jeremy Allison 1995.
This program is free software; you can redistribute it and/or modify
/*
Unix SMB/Netbios implementation.
Version 1.9.
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Locking functions
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
shared memory locking implementation
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
slow (lockfile) locking implementation
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Shared memory functions
- Copyright (C) Erik Devriendt 1996-1997
+ Copyright (C) Erik Devriendt 1996-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Shared memory functions - SYSV IPC implementation
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) David Chappell 1996-1997
+ Copyright (C) David Chappell 1996-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*
Unix SMB/Netbios implementation.
a async DNS handler
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Setup the signals that allow the debug log level
to by dynamically changed. */
+ /* If we are using the malloc debug code we can't use
+ SIGUSR1 and SIGUSR2 to do debug level changes. */
+#ifndef MEM_MAN
#if defined(SIGUSR1)
signal( SIGUSR1, SIGNAL_CAST sig_usr1 );
#endif /* SIGUSR1 */
#if defined(SIGUSR2)
signal( SIGUSR2, SIGNAL_CAST sig_usr2 );
#endif /* SIGUSR2 */
+#endif /* MEM_MAN */
while((opt = getopt(argc, argv, "as:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:f:")) != EOF)
{
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
to %s for workgroup %s.\n", namestr(&work->dmb_name), work->work_group ));
send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
- myname, 0x0, work->dmb_name.name, 0x20, work->dmb_addr, FIRST_SUBNET->myip);
+ myname, 0x0, work->dmb_name.name, 0x0, work->dmb_addr, FIRST_SUBNET->myip);
}
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
dgram->header.dgm_length = 0; /* Let build_dgram() handle this. */
dgram->header.packet_offset = 0;
- make_nmb_name(&dgram->source_name,srcname,0,scope);
+ make_nmb_name(&dgram->source_name,srcname,src_type,scope);
make_nmb_name(&dgram->dest_name,dstname,dest_type,scope);
ptr = &dgram->data[0];
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios library routines
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
SMB Version handling
- Copyright (C) John H Terpstra 1995-1997
+ Copyright (C) John H Terpstra 1995-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
- Copyright (C) Andrew Tridgell 1994-1997
- Copyright (C) Luke Kenneth Casson Leighton 1994-1997
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1994-1998
+ Copyright (C) Jeremy Allison 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Parameter loading functions
- Copyright (C) Karl Auer 1993,1997
+ Copyright (C) Karl Auer 1993-1998
Largely re-written by Andrew Tridgell, September 1994
/* -------------------------------------------------------------------------- **
* Microsoft Network Services for Unix, AKA., Andrew Tridgell's SAMBA.
*
- * This module Copyright (C) 1990, 1991, 1992, 1993, 1994 Karl Auer
+ * This module Copyright (C) 1990-1998 Karl Auer
*
* Rewritten almost completely by Christopher R. Hertel
* at the University of Minnesota, September, 1997.
- * This module Copyright (C) 1997 by the University of Minnesota
+ * This module Copyright (C) 1997-1998 by the University of Minnesota
* -------------------------------------------------------------------------- **
*
* This program is free software; you can redistribute it and/or modify
/*
* Unix SMB/Netbios implementation. Version 1.9. SMB parameters and setup
- * Copyright (C) Andrew Tridgell 1992-1997 Modified by Jeremy Allison 1995.
+ * Copyright (C) Andrew Tridgell 1992-1998 Modified by Jeremy Allison 1995.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
return False;
}
+ /* The following check is wrong - the NT hash is optional. */
+#if 0
if (*p == '*' || *p == 'X')
{
fclose(fp);
pw_file_unlock(lockfd);
return False;
}
+#endif
/* whew. entry is correctly formed. */
{
sprintf(&ascii_p16[i*2], "%02X", (uchar) pwd->smb_passwd[i]);
}
+ /* Add on the NT md4 hash */
+ ascii_p16[32] = ':';
+ wr_len = 65;
if (pwd->smb_nt_passwd != NULL)
{
- /* Add on the NT md4 hash */
- ascii_p16[32] = ':';
for (i = 0; i < 16; i++)
{
sprintf(&ascii_p16[(i*2)+33], "%02X", (uchar) pwd->smb_nt_passwd[i]);
}
- wr_len = 65;
}
else
{
- wr_len = 32;
+ /* No NT hash - write out an 'invalid' string. */
+ strcpy(&ascii_p16[33], "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
#ifdef DEBUG_PASSWORD
Unix SMB/Netbios implementation.
Version 1.9.
printcap parsing
- Copyright (C) Karl Auer 1993-1997
+ Copyright (C) Karl Auer 1993-1998
Re-working by Martin Kiff, 1994
/*
- * Copyright (C) 1997 by Norm Jacobs, Colorado Springs, Colorado, USA
- * Copyright (C) 1997 by Sun Microsystem, Inc.
+ * Copyright (C) 1997-1998 by Norm Jacobs, Colorado Springs, Colorado, USA
+ * Copyright (C) 1997-1998 by Sun Microsystem, Inc.
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
if (((tmp = strchr(buf, ' ')) == NULL) ||
((tmp = strchr(++tmp, ' ')) == NULL))
continue;
- name = ++tmp;
+ name = tmp++;
/* truncate the ": ..." */
if ((tmp = strchr(name, ':')) != NULL)
Unix SMB/Netbios implementation.
Version 1.9.
printing routines
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
buf->job = atoi(tok[LPRNG_JOBTOK]);
buf->size = atoi(tok[LPRNG_TOTALTOK]);
- buf->status = strequal(tok[LPRNG_RANKTOK],"active")?LPQ_PRINTING:LPQ_QUEUED;
+ if (strequal(tok[LPRNG_RANKTOK],"active"))
+ buf->status = LPQ_PRINTING;
+ else if (strequal(tok[LPRNG_RANKTOK],"hold"))
+ buf->status = LPQ_PAUSED;
+ else
+ buf->status = LPQ_QUEUED;
/* buf->time = time(NULL); */
buf->time = LPRng_time(tok,LPRNG_TIMETOK);
DEBUG(3,("Time reported for job %d is %s", buf->job, ctime(&buf->time)));
Unix SMB/Netbios implementation.
Version 1.9.
Samba utility functions
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
return(False);
}
#endif
+
+/***********************************************************
+ Code to check the lanman hashed password.
+************************************************************/
+
+BOOL check_lanman_password(char *user, unsigned char *pass1,
+ unsigned char *pass2, struct smb_passwd **psmbpw)
+{
+ unsigned char unenc_new_pw[16];
+ unsigned char unenc_old_pw[16];
+ struct smb_passwd *smbpw;
+
+ *psmbpw = NULL;
+
+ become_root(0);
+ smbpw = get_smbpwd_entry(user, 0);
+ unbecome_root(0);
+
+ if(smbpw == NULL)
+ {
+ DEBUG(0,("check_lanman_password: get_smbpwd_entry returned NULL\n"));
+ return False;
+ }
+
+ if(smbpw->smb_passwd == NULL)
+ {
+ DEBUG(0,("check_lanman_password: no lanman password !\n"));
+ return False;
+ }
+
+ /* Get the new lanman hash. */
+ D_P16(smbpw->smb_passwd, pass2, unenc_new_pw);
+
+ /* Use this to get the old lanman hash. */
+ D_P16(unenc_new_pw, pass1, unenc_old_pw);
+
+ /* Check that the two old passwords match. */
+ if(memcmp(smbpw->smb_passwd, unenc_old_pw, 16))
+ {
+ DEBUG(0,("check_lanman_password: old password doens't match.\n"));
+ return False;
+ }
+
+ *psmbpw = smbpw;
+ return True;
+}
+
+/***********************************************************
+ Code to change the lanman hashed password.
+ It nulls out the NT hashed password as it will
+ no longer be valid.
+************************************************************/
+
+BOOL change_lanman_password(struct smb_passwd *smbpw, char *pass1, char *pass2)
+{
+ char unenc_new_pw[16];
+ BOOL ret;
+
+ if(smbpw == NULL)
+ {
+ DEBUG(0,("change_lanman_password: get_smbpwd_entry returned NULL\n"));
+ return False;
+ }
+
+ if(smbpw->smb_passwd == NULL)
+ {
+ DEBUG(0,("change_lanman_password: no lanman password !\n"));
+ return False;
+ }
+
+ /* Get the new lanman hash. */
+ D_P16(smbpw->smb_passwd, pass2, unenc_new_pw);
+
+ smbpw->smb_passwd = unenc_new_pw;
+ smbpw->smb_nt_passwd = NULL; /* We lose the NT hash. Sorry. */
+
+ /* Now write it into the file. */
+ become_root(0);
+ ret = mod_smbpwd_entry(smbpw);
+ unbecome_root(0);
+
+ return ret;
+}
Unix SMB/Netbios implementation.
Version 1.9.
Directory handling routines
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Inter-process communication and named pipe handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
SMB Version handling
- Copyright (C) John H Terpstra 1995-1997
+ Copyright (C) John H Terpstra 1995-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
uint32 servertype = IVAL(p,4);
char *p2;
int data_len, fixed_len, string_len;
- int f_len, s_len;
+ int f_len = 0, s_len = 0;
struct srv_info_struct *servers=NULL;
int counted=0,total=0;
int i,missed;
int total=0,counted=0;
int i;
int data_len, fixed_len, string_len;
- int f_len, s_len;
+ int f_len = 0, s_len = 0;
if (!prefix_ok(str1,"WrLeh")) return False;
if (!check_share_info(uLevel,str2)) return False;
p = skip_string(p,1);
- StrnCpy(pass1,p,16);
- StrnCpy(pass2,p+16,16);
+ memcpy(pass1,p,16);
+ memcpy(pass2,p+16,16);
*rparam_len = 4;
*rparam = REALLOC(*rparam,*rparam_len);
DEBUG(3,("Set password for <%s>\n",user));
+ /*
+ * Attempt the plaintext password change first.
+ * Older versions of Windows seem to do this.
+ */
+
if (password_ok(user,pass1,strlen(pass1),NULL) &&
chgpasswd(user,pass1,pass2))
{
SSVAL(*rparam,0,NERR_Success);
}
+ /*
+ * If the plaintext change failed, attempt
+ * the encrypted. NT will generate this
+ * after trying the samr method.
+ */
+
+ if(SVAL(*rparam,0) != NERR_Success)
+ {
+ struct smb_passwd *smbpw = NULL;
+
+ if(check_lanman_password(user,(unsigned char *)pass1,(unsigned char *)pass2, &smbpw) &&
+ change_lanman_password(smbpw,(unsigned char *)pass1,(unsigned char *)pass2))
+ {
+ SSVAL(*rparam,0,NERR_Success);
+ }
+ }
+
bzero(pass1,sizeof(fstring));
bzero(pass2,sizeof(fstring));
Unix SMB/Netbios implementation.
Version 1.9.
Name mangling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB messaging
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Password and authentication handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Pipe SMB reply routines
- Copyright (C) Andrew Tridgell 1992-1997,
- Copyright (C) Luke Kenneth Casson Leighton 1996-1997.
- Copyright (C) Paul Ashton 1997.
+ Copyright (C) Andrew Tridgell 1992-1998
+ Copyright (C) Luke Kenneth Casson Leighton 1996-1998
+ Copyright (C) Paul Ashton 1997-1998.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
file read prediction routines
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
support for quotas
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Main SMB reply routines
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
if ((fmode & ~dirtype) & (aHIDDEN | aSYSTEM))
return(False);
- if (!check_file_sharing(cnum,fname)) return(False);
+ if (!check_file_sharing(cnum,fname,False)) return(False);
return(True);
}
if (!CAN_WRITE(cnum)) return(False);
if (sys_lstat(fname,&sbuf) != 0) return(False);
- if (!check_file_sharing(cnum,fname)) return(False);
+ if (!check_file_sharing(cnum,fname,True)) return(False);
return(True);
}
Unix SMB/Netbios implementation.
Version 1.9.
Main SMB server routines
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
check if the share mode on a file allows it to be deleted or unlinked
return True if sharing doesn't prevent the operation
********************************************************************/
-BOOL check_file_sharing(int cnum,char *fname)
+BOOL check_file_sharing(int cnum,char *fname, BOOL rename_op)
{
int i;
int ret = False;
if(share_entry->op_type & BATCH_OPLOCK)
{
- DEBUG(5,("check_file_sharing: breaking oplock (%x) on file %s, \
+ /*
+ * It appears that the NT redirector may have a bug, in that
+ * it tries to do an SMBmv on a file that it has open with a
+ * batch oplock, and then fails to respond to the oplock break
+ * request. This only seems to occur when the client is doing an
+ * SMBmv to the smbd it is using - thus we try and detect this
+ * condition by checking if the file being moved is open and oplocked by
+ * this smbd process, and then not sending the oplock break in this
+ * special case. If the file was open with a deny mode that
+ * prevents the move the SMBmv will fail anyway with a share
+ * violation error. JRA.
+ */
+ if(rename_op && (share_entry->pid == pid))
+ {
+ DEBUG(0,("check_file_sharing: NT redirector workaround - rename attempted on \
+batch oplocked file %s, dev = %x, inode = %x\n", fname, dev, inode));
+#if 0
+ /*
+ * This next line is a test that allows the deny-mode
+ * processing to be skipped. JRA.
+ */
+ continue;
+#endif
+ }
+ else
+ {
+ DEBUG(5,("check_file_sharing: breaking oplock (%x) on file %s, \
dev = %x, inode = %x\n", share_entry->op_type, fname, dev, inode));
- /* Oplock break.... */
- unlock_share_entry(cnum, dev, inode, token);
- if(request_oplock_break(share_entry, dev, inode) == False)
- {
- free((char *)old_shares);
- DEBUG(0,("check_file_sharing: FAILED when breaking oplock (%x) on file %s, \
+ /* Oplock break.... */
+ unlock_share_entry(cnum, dev, inode, token);
+ if(request_oplock_break(share_entry, dev, inode) == False)
+ {
+ free((char *)old_shares);
+ DEBUG(0,("check_file_sharing: FAILED when breaking oplock (%x) on file %s, \
dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode));
- return False;
+ return False;
+ }
+ lock_share_entry(cnum, dev, inode, &token);
+ broke_oplock = True;
+ break;
}
- lock_share_entry(cnum, dev, inode, &token);
- broke_oplock = True;
- break;
}
/* someone else has a share lock on it, check to see
shutdown_server = True;
break;
}
+
+ /*
+ * There are certain SMB requests that we shouldn't allow
+ * to recurse. opens, renames and deletes are the obvious
+ * ones. This is handled in the switch_message() function.
+ * If global_oplock_break is set they will push the packet onto
+ * the pending smb queue and return -1 (no reply).
+ * JRA.
+ */
+
process_smb(inbuf, outbuf);
/*
char op_break_msg[OPLOCK_BREAK_MSG_LEN];
struct sockaddr_in addr_out;
int pid = getpid();
+ time_t start_time;
+ int time_left;
if(pid == share_entry->pid)
{
* While we get messages that aren't ours, loop.
*/
- while(1)
+ start_time = time(NULL);
+ time_left = OPLOCK_BREAK_TIMEOUT+OPLOCK_BREAK_TIMEOUT_FUDGEFACTOR;
+
+ while(time_left >= 0)
{
char op_break_reply[UDP_CMD_HEADER_LEN+OPLOCK_BREAK_MSG_LEN];
int32 reply_msg_len;
char *reply_msg_start;
if(receive_local_message(oplock_sock, op_break_reply, sizeof(op_break_reply),
- (OPLOCK_BREAK_TIMEOUT+OPLOCK_BREAK_TIMEOUT_FUDGEFACTOR) * 1000) == False)
+ time_left ? time_left * 1000 : 1) == False)
{
if(smb_read_error == READ_TIMEOUT)
{
return False;
}
- /*
- * If the response we got was not an answer to our message, but
- * was a completely different request, push it onto the pending
- * udp message stack so that we can deal with it in the main loop.
- * It may be another oplock break request to us.
- */
-
- /*
- * Local note from JRA. There exists the possibility of a denial
- * of service attack here by allowing non-root processes running
- * on a local machine sending many of these pending messages to
- * a smbd port. Currently I'm not sure how to restrict the messages
- * I will queue (although I could add a limit to the queue) to
- * those received by root processes only. There should be a
- * way to make this bulletproof....
- */
-
reply_msg_len = IVAL(op_break_reply,UDP_CMD_LEN_OFFSET);
reply_from_port = SVAL(op_break_reply,UDP_CMD_PORT_OFFSET);
continue;
}
- if(((SVAL(reply_msg_start,UDP_MESSAGE_CMD_OFFSET) & CMD_REPLY) == 0) ||
- (reply_from_port != share_entry->op_port) ||
+ /*
+ * Test to see if this is the reply we are awaiting.
+ */
+
+ if((SVAL(reply_msg_start,UDP_MESSAGE_CMD_OFFSET) & CMD_REPLY) &&
+ (reply_from_port == share_entry->op_port) &&
(memcmp(&reply_msg_start[OPLOCK_BREAK_PID_OFFSET],
&op_break_msg[OPLOCK_BREAK_PID_OFFSET],
- OPLOCK_BREAK_MSG_LEN - OPLOCK_BREAK_PID_OFFSET) != 0))
+ OPLOCK_BREAK_MSG_LEN - OPLOCK_BREAK_PID_OFFSET) == 0))
{
- DEBUG(3,("%s request_oplock_break: received other message whilst awaiting \
-oplock break response from pid %d on port %d for dev = %x, inode = %x.\n",
- timestring(), share_entry->pid, share_entry->op_port, dev, inode));
- if(push_local_message(op_break_reply, sizeof(op_break_reply)) == False)
- return False;
- continue;
+ /*
+ * This is the reply we've been waiting for.
+ */
+ break;
+ }
+ else
+ {
+ /*
+ * This is another message - probably a break request.
+ * Process it to prevent potential deadlock.
+ * Note that the code in switch_message() prevents
+ * us from recursing into here as any SMB requests
+ * we might process that would cause another oplock
+ * break request to be made will be queued.
+ * JRA.
+ */
+
+ process_local_message(oplock_sock, op_break_reply, sizeof(op_break_reply));
}
- break;
+ time_left -= (time(NULL) - start_time);
}
DEBUG(3,("%s request_oplock_break: broke oplock.\n", timestring()));
#define TIME_INIT (1<<2)
#define CAN_IPC (1<<3)
#define AS_GUEST (1<<5)
-
+#define QUEUE_IN_OPLOCK (1<<6)
/*
define a list of possible SMB messages and their corresponding
{SMBsetatr,"SMBsetatr",reply_setatr,AS_USER | NEED_WRITE},
{SMBchkpth,"SMBchkpth",reply_chkpth,AS_USER},
{SMBsearch,"SMBsearch",reply_search,AS_USER},
- {SMBopen,"SMBopen",reply_open,AS_USER},
+ {SMBopen,"SMBopen",reply_open,AS_USER | QUEUE_IN_OPLOCK },
/* note that SMBmknew and SMBcreate are deliberately overloaded */
{SMBcreate,"SMBcreate",reply_mknew,AS_USER},
{SMBmknew,"SMBmknew",reply_mknew,AS_USER},
- {SMBunlink,"SMBunlink",reply_unlink,AS_USER | NEED_WRITE},
+ {SMBunlink,"SMBunlink",reply_unlink,AS_USER | NEED_WRITE | QUEUE_IN_OPLOCK},
{SMBread,"SMBread",reply_read,AS_USER},
{SMBwrite,"SMBwrite",reply_write,AS_USER},
{SMBclose,"SMBclose",reply_close,AS_USER | CAN_IPC},
{SMBmkdir,"SMBmkdir",reply_mkdir,AS_USER | NEED_WRITE},
{SMBrmdir,"SMBrmdir",reply_rmdir,AS_USER | NEED_WRITE},
{SMBdskattr,"SMBdskattr",reply_dskattr,AS_USER},
- {SMBmv,"SMBmv",reply_mv,AS_USER | NEED_WRITE},
+ {SMBmv,"SMBmv",reply_mv,AS_USER | NEED_WRITE | QUEUE_IN_OPLOCK},
/* this is a Pathworks specific call, allowing the
changing of the root path */
{SMBlseek,"SMBlseek",reply_lseek,AS_USER},
{SMBflush,"SMBflush",reply_flush,AS_USER},
- {SMBctemp,"SMBctemp",reply_ctemp,AS_USER},
- {SMBsplopen,"SMBsplopen",reply_printopen,AS_USER},
+ {SMBctemp,"SMBctemp",reply_ctemp,AS_USER | QUEUE_IN_OPLOCK },
+ {SMBsplopen,"SMBsplopen",reply_printopen,AS_USER | QUEUE_IN_OPLOCK },
{SMBsplclose,"SMBsplclose",reply_printclose,AS_USER},
{SMBsplretq,"SMBsplretq",reply_printqueue,AS_USER|AS_GUEST},
{SMBsplwr,"SMBsplwr",reply_printwrite,AS_USER},
{SMBtrans,"SMBtrans",reply_trans,AS_USER | CAN_IPC},
{SMBtranss,"SMBtranss",NULL,AS_USER | CAN_IPC},
{SMBioctls,"SMBioctls",NULL,AS_USER},
- {SMBcopy,"SMBcopy",reply_copy,AS_USER | NEED_WRITE},
- {SMBmove,"SMBmove",NULL,AS_USER | NEED_WRITE},
+ {SMBcopy,"SMBcopy",reply_copy,AS_USER | NEED_WRITE | QUEUE_IN_OPLOCK },
+ {SMBmove,"SMBmove",NULL,AS_USER | NEED_WRITE | QUEUE_IN_OPLOCK },
- {SMBopenX,"SMBopenX",reply_open_and_X,AS_USER | CAN_IPC},
+ {SMBopenX,"SMBopenX",reply_open_and_X,AS_USER | CAN_IPC | QUEUE_IN_OPLOCK },
{SMBreadX,"SMBreadX",reply_read_and_X,AS_USER},
{SMBwriteX,"SMBwriteX",reply_write_and_X,AS_USER},
{SMBlockingX,"SMBlockingX",reply_lockingX,AS_USER},
/* LANMAN2.0 PROTOCOL FOLLOWS */
{SMBfindnclose, "SMBfindnclose", reply_findnclose, AS_USER},
{SMBfindclose, "SMBfindclose", reply_findclose,AS_USER},
- {SMBtrans2, "SMBtrans2", reply_trans2, AS_USER},
+ {SMBtrans2, "SMBtrans2", reply_trans2, AS_USER | QUEUE_IN_OPLOCK },
{SMBtranss2, "SMBtranss2", reply_transs2, AS_USER},
/* messaging routines */
else
{
DEBUG(3,("switch message %s (pid %d)\n",smb_messages[match].name,pid));
+
+ if(global_oplock_break && (smb_messages[match].flags & QUEUE_IN_OPLOCK))
+ {
+ /*
+ * Queue this message as we are the process of an oplock break.
+ */
+
+ DEBUG(2,("%s: switch_message: queueing message due to being in oplock break state.\n",
+ timestring() ));
+
+ push_smb_message( inbuf, size);
+ return -1;
+ }
+
if (smb_messages[match].fn)
{
int cnum = SVAL(inbuf,smb_tid);
/* Setup the signals that allow the debug log level
to by dynamically changed. */
+ /* If we are using the malloc debug code we can't use
+ SIGUSR1 and SIGUSR2 to do debug level changes. */
+
+#ifndef MEM_MAN
#if defined(SIGUSR1)
signal( SIGUSR1, SIGNAL_CAST sig_usr1 );
#endif /* SIGUSR1 */
#if defined(SIGUSR2)
signal( SIGUSR2, SIGNAL_CAST sig_usr2 );
#endif /* SIGUSR2 */
+#endif /* MEM_MAN */
DEBUG(3,("%s loaded services\n",timestring()));
Unix SMB/Netbios implementation.
Version 1.9.
external program running routine
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB transaction2 handling
- Copyright (C) Jeremy Allison 1994-1997
+ Copyright (C) Jeremy Allison 1994-1998
Extensively modified by Andrew Tridgell, 1995
Unix SMB/Netbios implementation.
Version 1.9.
uid/user handling
- Copyright (C) Andrew Tridgell 1992-1997
+ Copyright (C) Andrew Tridgell 1992-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*
support vtp-sessions
-written by Christian A. Lademann <cal@zls.com>
+(C) written by Christian A. Lademann <cal@zls.com>
*/
/*
Version 1.9.
Create printer definition files.
- Copyright (C) Jean-Francois.Micouleau@utc.fr, 10/26/97
+ Copyright (C) Jean-Francois.Micouleau@utc.fr, 10/26/97 - 1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
int i;
fgets(s,n,stream);
- while (LString1 = strchr(s,'%')) {
+ while ((LString1 = strchr(s,'%')) != NULL) {
if (!(LString2 = strchr(LString1+1,'%'))) break;
*LString2 = '\0';
strcpy(String,LString1+1);
if (strncmp(sbuffer[i],String,strlen(String))==0)
{
strcpy(String,sbuffer[i]);
- if (temp = strchr(String,'=')) ++temp;
+ if ((temp = strchr(String,'=')) != NULL) ++temp;
strcpy(String,temp);
break;
}
} else {
part = strchr(buffer[i],',');
if (part) {
- if (mpart = strrchr(part+1,',')) {
+ if ((mpart = strrchr(part+1,','))!=NULL) {
strcpy(buffer[i],mpart+1);
} else
*part = '\0';
temp = strtok(languagemonitor,",");
if (*temp == '"') ++temp;
strcpy(languagemonitor,temp);
- if (temp = strchr(languagemonitor,'"')) *temp = '\0';
+ if ((temp = strchr(languagemonitor,'"'))!=NULL) *temp = '\0';
}
if (i) fprintf(stderr,"End of section found\n");
Version 1.9.
Create codepage files from codepage_def.XXX files.
- Copyright (C) Jeremy Allison 1997
+ Copyright (C) Jeremy Allison 1997-1998.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
NBT client - used to lookup netbios names
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*
* Unix SMB/Netbios implementation. Version 1.9. smbpasswd module. Copyright
- * (C) Jeremy Allison 1995-1997.
+ * (C) Jeremy Allison 1995-1998
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
Unix SMB/Netbios implementation.
Version 1.9.
status reporting
- Copyright (C) Andrew Tridgell 1994-1997
+ Copyright (C) Andrew Tridgell 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
Test validity of smb.conf
- Copyright (C) Karl Auer 1993, 1994-1997
+ Copyright (C) Karl Auer 1993, 1994-1998
Extensively modified by Andrew Tridgell, 1995
Unix SMB/Netbios implementation.
Version 1.9.
test printer setup
- Copyright (C) Karl Auer 1993, 1994-1997
+ Copyright (C) Karl Auer 1993, 1994-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
SMB torture tester
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*
some simple CGI helper routines
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
html smb.conf editing - prototype only
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Unix SMB/Netbios implementation.
Version 1.9.
html status reporting
- Copyright (C) Andrew Tridgell 1997
+ Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by