Re: smbstatus -b in a 100% NT environment
On Mon, 2002-12-16 at 23:17, Guillaume LACHENAL wrote: > Is there way to obtain the same result thant 'smbstatus -b' > (ie knowing who is logged in which computer) when the PDC > is a not a Samba one ? > > Is there a way to request this type of query on a NT PDC ? > (third party {linux|win32} tools / urls welcomed) Server manager on NT will show you that - I don't think Samba has a remote client for that at present, but it would not be particularly hard to write. > Or is there another way to do it via network sniffing ? > > thanks a lot ! > > regards, > > Guillaume -- Andrew Bartlett [EMAIL PROTECTED] Manager, Authentication Subsystems, Samba Team [EMAIL PROTECTED] Student Network Administrator, Hawker College [EMAIL PROTECTED] http://samba.org http://build.samba.org http://hawkerc.net signature.asc Description: This is a digitally signed message part
Re: [PATCH] parametric options
On Wed, 2003-01-01 at 02:44, Stefan (metze) Metzmacher wrote: > Hi *, > > here are the parametric option changes of my big patch... > > all lp_param_*() functions now take the default value as last parameter > this is usefull for all fn's and needed for the enum,bool,int and ulong > functions :-) Is this the best way to do it - if we are going to have a notion of defaults, then doing it per-call is just waiting for disaster! Given that we are moving to a 'registration' style of module system (where we know at startup what modules we have), I think we really should move 'parametric options' to a registrations system too. Indeed, this would allow the implement ion of callback syntax checking, which could make testparm useful again. > lp_parm_string_list() now use talloc_str_list_make() and > talloc_realloc_str_list_make and caches the the result for the called > seperator, so if the function is called with the same separator it is not > needed to call *_str_list_make() > > if the function is called with an other separator the old list is free'ed > > so we didn't get a memory leek if we call: > > lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL); > lp_parm_string_list(SNUM(conn), "test","name",";,.", NULL); > lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL); > lp_parm_string_list(SNUM(conn), "test","name",";,.", NULL); > lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL); Why do we allow the separator to be changed at all? The 'normal' options in Samba don't all this - I really don't see the need for the added complexity. Furthermore, how are you going to tell SWAT etc about this - it should display lists as lists, and not depend on function parameters to get it right. I just don't like the idea that a list could change depending on a parameter somebody will always get slightly wrong. > talloc_realloc_str_list_make() > > a add talloc_free() witch free's the memory of one talloc'ed memory segment This doesn't seem right - why not just free and replace that talloc context? > a also add a view talloc_realloc_*() functions > > talloc_realloc_strdup() ... Why? Andrew Bartlett -- Andrew Bartlett [EMAIL PROTECTED] Manager, Authentication Subsystems, Samba Team [EMAIL PROTECTED] Student Network Administrator, Hawker College [EMAIL PROTECTED] http://samba.org http://build.samba.org http://hawkerc.net signature.asc Description: This is a digitally signed message part
Re: Patch for unix extensions
On Tue, Dec 31, 2002 at 10:36:33AM +0100, Simo Sorce wrote: > > Jeremy, > in case of unix extensions, shouldn't we pass the symlink as is and not > resolve it? Yes we do - if the client uses the UNIX extensions to readlink. The problem is a UNIX extension client could set a symlink on the server (which in a UNIX <--> UNIX scenario would never be resolved on the server, but read and resolved on the clients filesystem) and then do a normal SMB open call on it to escape the restrictions of exporting only a small part of the servers filesystem. > I think a proper unix-like file system should be able to return links. It can. I just can't trust the client to do this. Jeremy.
[PATCH] parametric options
Hi *, here are the parametric option changes of my big patch... all lp_param_*() functions now take the default value as last parameter this is usefull for all fn's and needed for the enum,bool,int and ulong functions :-) lp_parm_string_list() now use talloc_str_list_make() and talloc_realloc_str_list_make and caches the the result for the called seperator, so if the function is called with the same separator it is not needed to call *_str_list_make() if the function is called with an other separator the old list is free'ed so we didn't get a memory leek if we call: lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL); lp_parm_string_list(SNUM(conn), "test","name",";,.", NULL); lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL); lp_parm_string_list(SNUM(conn), "test","name",";,.", NULL); lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL); talloc_realloc_str_list_make() a add talloc_free() witch free's the memory of one talloc'ed memory segment a also add a view talloc_realloc_*() functions talloc_realloc_strdup() ... here''s the patch for HEAD metze - Stefan "metze" Metzmacher <[EMAIL PROTECTED]>diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=*.so --exclude=.#* --exclude=Makefile --exclude=stamp-h --exclude=configure --exclude=findsmb --exclude=*proto*.h --exclude=build_env.h --exclude=tdbsam2_parse_info.h --exclude=config.* --exclude=bin --exclude=*.configure HEAD/source/include/local.h HEAD-param/source/include/local.h --- HEAD/source/include/local.h Thu Oct 24 11:10:57 2002 +++ HEAD-param/source/include/local.h Mon Dec 30 21:35:32 2002 @@ -75,6 +75,8 @@ /* separators for lists */ #define LIST_SEP " \t,;\n\r" +#define S_LIST_ABS 16 /* List Allocation Block Size */ + /* wchar separators for lists */ #define LIST_SEP_W wchar_list_sep diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=*.so --exclude=.#* --exclude=Makefile --exclude=stamp-h --exclude=configure --exclude=findsmb --exclude=*proto*.h --exclude=build_env.h --exclude=tdbsam2_parse_info.h --exclude=config.* --exclude=bin --exclude=*.configure HEAD/source/lib/talloc.c HEAD-param/source/lib/talloc.c --- HEAD/source/lib/talloc.cTue Dec 24 01:14:22 2002 +++ HEAD-param/source/lib/talloc.c Mon Dec 30 21:36:49 2002 @@ -216,6 +216,32 @@ void *talloc_realloc(TALLOC_CTX *t, void return NULL; } +/** free the memory allocated inside @p t, but not @p t + * itself. */ +void talloc_free(TALLOC_CTX *t, void *ptr) +{ + struct talloc_chunk *tc; + struct talloc_chunk *prev=NULL; + + if (!t||!ptr) + return; + + for (tc=t->list; tc; prev=tc,tc=tc->next) { + if (tc->ptr == ptr) { + if (prev) { + prev->next = tc->next; + } else { + t->list = tc->next; + } + + t->total_alloc_size -= tc->size; + SAFE_FREE(tc->ptr); + SAFE_FREE(tc); + break; + } + } +} + /** Destroy all the memory allocated inside @p t, but not @p t * itself. */ void talloc_destroy_pool(TALLOC_CTX *t) @@ -288,6 +314,17 @@ void *talloc_memdup(TALLOC_CTX *t, const return newp; } +/** realloc_memdup with a talloc_realloc. */ +void *talloc_realloc_memdup(TALLOC_CTX *t, void *ptr, const void *p, size_t size) +{ + void *newp = talloc_realloc(t,ptr,size); + + if (newp) + memcpy(newp, p, size); + + return newp; +} + /** strdup with a talloc */ char *talloc_strdup(TALLOC_CTX *t, const char *p) { @@ -297,11 +334,95 @@ char *talloc_strdup(TALLOC_CTX *t, const return NULL; } +/** realloc_strdup with a talloc */ +char *talloc_realloc_strdup(TALLOC_CTX *t, void *ptr, const char *p) +{ + if (p) + return talloc_realloc_memdup(t, ptr, p, strlen(p) + 1); + else + return NULL; +} + +void talloc_str_list_free(TALLOC_CTX *t, char ***list) +{ + char **tlist; + + if (!list || !*list) + return; + tlist = *list; + for(; *tlist; tlist++) + talloc_free(t,*tlist); + talloc_free(t,*list); +} + +/** str_list_make with a talloc */ +char **talloc_str_list_make(TALLOC_CTX *t, const char *string, const char *sep) +{ + char **list=NULL, **rlist; + const char *str; + char *s; + int num=0, lsize=0; + pstring tok; + + if (!string || !*string) + return NULL; + s = strdup(string); + if (!s) { + DEBUG(0,("talloc_str_list_make: Unable to allocate memory")); + return NULL; + } + if (!sep) sep = LIST_SEP; + + str = s; + while (next_token(&str, tok,
Re: net rpc shutdown - how to poweroff
How do I disable NTLMSSP in Windows 2000? Thank you Willi Simo Sorce wrote: Thank you Willi, unfortuately the traces is encapsulated in an ntlmssp encrypted session so I cannot see anything. Can you kindly disable ntlmssp and redo the sniff from beginning? feel free to send the sniff only to me if you fear information disclosure. Simo. On Tue, 2002-12-31 at 00:38, Willi Mann wrote: Hi Simo! I've put the sniff and the script which produced the shutdown on my homepage: http://www.wm1.at/samba/wmisniff.bin http://www.wm1.at/samba/RemoteShutdown.vbs w2k Professional german (192.168.0.1, P4) has the sniffer and asks a w2k server german (192.168.0.254, WILLI) to do the shutdown. It only works if you have the same passwords on both of the two machines. Don't ask me about the sense of the for--next loop. Willi Simo Sorce wrote: On Mon, 2002-12-30 at 01:06, Willi Mann wrote: Hi Andrew! The existing net rpc shutdown function doesn't seem to be able to do a power off. It seems to be an implementation of the initiateSystemShutdown API-call, which is used in many freeware closed-source shutdown applications. I've played around with the flags in the current Samba-implementation with the following result: If one of the first 8 bits is set to 1 the machine reboots. The second 8 bits mark the forced shutdown but I haven't verified that it makes a difference to non-forced shutdowns. the 16bit flags we show in the source are really 2 booleans in the form of two bytes imho, I'm modifying the code in samba to behave this way. I made some test and I think you are right the rpc shutdown function is equivalent to InitiateSystemShutdownEx call on windows, so no power off possible, only the 2 booleans: force shutdown and reboot on shutdown. There is a way for a working remote power off. The WMI-framework provides a function called win32shutdown. This function is also used by the Management Console-Shutdown. It offers nearly all flags which are available in the ExitWindowsEx-function. It is completely different to the net rpc shutdown. I've modified a VBscript-example provided in the WMI-SDK to get the shortest possible shutdown-session and sniffed it. There are about 100 packets on the wire (incl. authentication, SYNs, RSTs, etc.) I'll try to work out more about that in the next few days. If you can send me the trace (ina aformate readable by ethereal) I'm interested at looking into it and see how it is done. Simo.
Re: BUG, PATCH: Signed/unsigned mismatch causes Samba to missdisk-full condition.
Thank you, I've fixed it in HEAD, 3.0 and 2.2 cvs branches Simo. On Tue, 2002-12-31 at 10:07, Ray Simard wrote: > This was discovered, and the correction tested, on a, i386 Linux box, kernel 2.4.18. >Samba > version is 2.7.7a, patched from 2.2.6 pristine source. > > In smbd/reply.c reply_writebraw: > > The return value from write_file is compared to numtowrite, an unsigned value. > If the write failed, returning -1, the comparison sees it as the max unsigned value, > and the failure isn't detected. The Windoze box user sees no write error, but the >file > later turns out to have zero size or content. Later on a debug message about a >presumed mis-estimate > of the write size is logged at level 3 or above, but otherwise ignored. > > This mismatch is apparently an oversight, since similar writes and checks elsewhere > in the same file properly cast the unsigned numtowrite to signed before checking. > This merely brings this case into agreement with them. > > The FIXME? message is just a suggestion to handle the off chance that future changes > to the code might cause some confusion there. No code changes there. > > This change has been compiled and tested, and works as expected. > > (If this isn't the right way to submit a patch, please enlighten me. This one is so >short that > I don't imagine it should be a problem.) > > --- reply.c Tue Dec 31 00:45:00 2002 > +++ reply.c Tue Dec 31 00:48:27 2002 > @@ -2673,5 +2673,5 @@ > fsp->fnum, (double)startpos, (int)numtowrite, (int)nwritten, >(int)write_through)); > > - if (nwritten < numtowrite) { > + if (nwritten < (ssize_t) numtowrite) { > END_PROFILE(SMBwritebraw); > return(UNIXERROR(ERRHRD,ERRdiskfull)); > @@ -2707,5 +2707,5 @@ > exit_server("secondary writebraw failed"); > } > - > +/* FIXME? Pedantically defensive progrmming might call for a second check for >(nwritten < 0) here. */ > if (tcount > nwritten+numtowrite) { > DEBUG(3,("Client overestimated the write %d %d %d\n", > > Ray Simard [EMAIL PROTECTED] -- Simo Sorce- [EMAIL PROTECTED] Samba Team- http://www.samba.org Italian Site - http://samba.xsec.it
Re: Patch for unix extensions
On Tue, 2002-12-31 at 20:36, Simo Sorce wrote: > On Tue, 2002-12-31 at 03:29, [EMAIL PROTECTED] wrote: > > Sorry, I have some problems with this patch. It allows a > > client to add a symlink to a Samba share which points to > > a file elsewhere on the server disk. For example : > > > > create a symlink from /home/myhome/p -> /etc/passwd. > > > > Now as Samba resolves names on the *server* not the client, > > anyone opening /home/myhome/p using smbclient or a Windows > > client will get /etc/passwd. This (IMHO) is not desirable. > > Jeremy, > in case of unix extensions, shouldn't we pass the symlink as is and not > resolve it? > > We may have a parameter that when set permit link creations and also > returns link as is instead of resolving them. > > I think a proper unix-like file system should be able to return links. I was wondering if/how the 'wide links' parameter could/should play with this. CIFS might not be the best unix->unix file system, but a lot of people much prefer this over NFS... Andrew Bartlett -- Andrew Bartlett [EMAIL PROTECTED] Manager, Authentication Subsystems, Samba Team [EMAIL PROTECTED] Student Network Administrator, Hawker College [EMAIL PROTECTED] http://samba.org http://build.samba.org http://hawkerc.net signature.asc Description: This is a digitally signed message part
Re: Patch for unix extensions
On Tue, 2002-12-31 at 03:29, [EMAIL PROTECTED] wrote: > Sorry, I have some problems with this patch. It allows a > client to add a symlink to a Samba share which points to > a file elsewhere on the server disk. For example : > > create a symlink from /home/myhome/p -> /etc/passwd. > > Now as Samba resolves names on the *server* not the client, > anyone opening /home/myhome/p using smbclient or a Windows > client will get /etc/passwd. This (IMHO) is not desirable. Jeremy, in case of unix extensions, shouldn't we pass the symlink as is and not resolve it? We may have a parameter that when set permit link creations and also returns link as is instead of resolving them. I think a proper unix-like file system should be able to return links. Simo. -- Simo Sorce - [EMAIL PROTECTED] Xsec s.r.l. via Durando 10 Ed. G - 20158 - Milano tel. +39 02 2399 7130 - fax: +39 02 700 442 399 signature.asc Description: This is a digitally signed message part
BUG, PATCH: Signed/unsigned mismatch causes Samba to miss disk-full condition.
This was discovered, and the correction tested, on a, i386 Linux box, kernel 2.4.18. Samba version is 2.7.7a, patched from 2.2.6 pristine source. In smbd/reply.c reply_writebraw: The return value from write_file is compared to numtowrite, an unsigned value. If the write failed, returning -1, the comparison sees it as the max unsigned value, and the failure isn't detected. The Windoze box user sees no write error, but the file later turns out to have zero size or content. Later on a debug message about a presumed mis-estimate of the write size is logged at level 3 or above, but otherwise ignored. This mismatch is apparently an oversight, since similar writes and checks elsewhere in the same file properly cast the unsigned numtowrite to signed before checking. This merely brings this case into agreement with them. The FIXME? message is just a suggestion to handle the off chance that future changes to the code might cause some confusion there. No code changes there. This change has been compiled and tested, and works as expected. (If this isn't the right way to submit a patch, please enlighten me. This one is so short that I don't imagine it should be a problem.) --- reply.c Tue Dec 31 00:45:00 2002 +++ reply.c Tue Dec 31 00:48:27 2002 @@ -2673,5 +2673,5 @@ fsp->fnum, (double)startpos, (int)numtowrite, (int)nwritten, (int)write_through)); - if (nwritten < numtowrite) { + if (nwritten < (ssize_t) numtowrite) { END_PROFILE(SMBwritebraw); return(UNIXERROR(ERRHRD,ERRdiskfull)); @@ -2707,5 +2707,5 @@ exit_server("secondary writebraw failed"); } - +/* FIXME? Pedantically defensive progrmming might call for a second check for +(nwritten < 0) here. */ if (tcount > nwritten+numtowrite) { DEBUG(3,("Client overestimated the write %d %d %d\n", Ray Simard [EMAIL PROTECTED]