No subject

Lowell C. Savage savage at
Thu Oct 9 01:24:34 GMT 1997

Gerald W. Carter wrote:
> Louis Mandelstam wrote:
> > 
> > It would seem that the Win95 login routine doesn't start until after
> > the preexec script has completed.  Presumed that the two processes
> > would happen in parallel and that it was just a case of the server
> > process being much quicker causing the .REG to be ready by the time
> > the login script expects it.
> > 
> Actually the login script starts and when the homes shared is mounted,
> Samba runs the preexec script before allowing the client to mount the
> share.

> > 
> > Are my assumptions correct?
> >
> > If yes, the only locking problem I need to worry about is when the
> > same username tries to log in at two client stations at the same time
> > - it could be possible that the one instance's preexec process could
> > trample on the other's.

> I don't think this is a problem normally.  Unless you preexec cript
> locks files and has a possible deadlock condition.

> ...

I didn't see a description in the various messages of where the file actually
is written.  If it is written to the \\server\netlogon directory, don't you
get a locking problem with two or more users loggin in?  I mean, if you have
a slow client logging on with one user, and a moment later, another user
logging on another client.  If the file is actually changed before the first
client gets to the point in its netlogon.bat script where it is using the
.reg file, does the first machine then create a registration entry that puts
user1 in user2's profile location?  Is this a problem?

What I did, was set up the netlogon.bat file to take care of the whole thing,
with all the customization of files taking place on the C: drive in the temp
directory that is supposed to be on all machines.  (Actually, it creates the
temp directory if there isn't one.)  The three critical lines in netlogon.bat
are something like:

net config | find "User name" > c:\tmp\logonnet.txt
subs c:\tmp\logonnet.txt c:\tmp\logonnet.bat "User name" "\\\\server\\netlogon\\logonnet.bat"
call c:\tmp\logonnet.bat

The first line creates a file that looks like:

	User name	joeuser

The second one uses a little C program I wrote to substitute the "User name"
for the name of the program I want to run.  Thus I get a one-line batch file
that runs the batch file I really want to run with the user name as a parameter.
To continue the example, the c:\tmp\logonnet.bat file contains:

	\\server\netlogon\logonnet.bat joeuser

Finally, I run that newly created batch file.  In the logonnet.bat on the
server, I use the same little "subs" utility to modify the .reg file--replacing
the string "username" with (in this case) "joeuser", and putting the modified
file into c:\tmp.

I've also got some other things going on--like setting up so that the user's
netlogon.bat gets called with parameters containing the PC's name and room
number.  Now, if only I could get that netlogon script to use bash or some
other decent shell, I could probably ditch all the crazy hack programs I'm

If someone has a public ftp directory they can donate, I'd be willing to send
or upload source and binary files for the programs I'm using.  They include
the following.

    subs	A simple text substitution program.
    ecomp	A simple file compare program that returns an error level.
    vcd		"Virtual Change Directory" changes to directory based on the
		volume label and a match found in a file.
    vcommand	"Virtual Command" creates a batch file which runs another
		command along with parameters found in a file--again based
		on the C: drive volume label.
    mdd		Make directory--fail silently.  (May finally be obsolete.)
    wait	Dos equivalent of "sleep".
    waittime	Wait with keystroke interrupt capability. (i.e. wait 10 seconds
		unless user types a key.

Lowell C. Savage
savage at

More information about the samba mailing list