mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
Initial version imported to CVS
This commit is contained in:
commit
65968b2943
318
docs/INSTALL.txt
Normal file
318
docs/INSTALL.txt
Normal file
@ -0,0 +1,318 @@
|
||||
HOW TO INSTALL AND TEST SAMBA
|
||||
=============================
|
||||
|
||||
|
||||
STEP 0. Read the man pages. They contain lots of useful info that will
|
||||
help to get you started. If you don't know how to read man pages then
|
||||
try something like:
|
||||
|
||||
nroff -man smbd.8 | more
|
||||
|
||||
STEP 1. Building the binaries
|
||||
|
||||
To do this, first edit the file source/Makefile. You will find that
|
||||
the Makefile has an entry for most unixes and you need to uncomment
|
||||
the one that matches your operating system.
|
||||
|
||||
You should also edit the section at the top of the Makefile which
|
||||
determines where things will be installed. You need to get this right
|
||||
before compilation as Samba needs to find some things at runtime
|
||||
(smbrun in particular). There are also settings for where you want
|
||||
your log files etc. Make sure you get these right, and that the
|
||||
directories exist.
|
||||
|
||||
Then type "make". This will create the binaries.
|
||||
|
||||
Once it's successfully compiled you can use "make install" to install
|
||||
the binaries and manual pages. You can separately install the binaries
|
||||
and/or man pages using "make installbin" and "make installman".
|
||||
|
||||
Note that if you are upgrading for a previous version of Samba you
|
||||
might like to know that the old versions of the binaries will be
|
||||
renamed with a ".old" extension. You can go back to the previous
|
||||
version with "make revert" if you find this version a disaster!
|
||||
|
||||
STEP 2. The all important step
|
||||
|
||||
At this stage you must fetch yourself a coffee or other drink you find
|
||||
stimulating. Getting the rest of the install right can sometimes be
|
||||
tricky, so you will probably need it.
|
||||
|
||||
If you have installed samba before then you can skip this step.
|
||||
|
||||
STEP 3. Create the smb configuration file.
|
||||
|
||||
There are sample configuration files in the examples subdirectory in
|
||||
the distribution. I suggest you read them carefully so you can see how
|
||||
the options go together in practice. See the man page for all the
|
||||
options.
|
||||
|
||||
The simplest useful configuration file would be something like this:
|
||||
|
||||
[homes]
|
||||
workgroup = MYGROUP
|
||||
guest ok = no
|
||||
read only = no
|
||||
|
||||
which would allow connections by anyone with an account on the server,
|
||||
using either their login name or "homes" as the service name. (Note
|
||||
that I also set the workgroup that Samba is part of. See BROWSING.txt
|
||||
for defails)
|
||||
|
||||
Note that "make install" will not install a smb.conf file. You need to
|
||||
create it yourself. You will also need to create the path you specify
|
||||
in the Makefile for the logs etc, such as /usr/local/samba.
|
||||
|
||||
Make sure you put the smb.conf file in the same place you specified in
|
||||
the Makefile.
|
||||
|
||||
STEP 4. Test your config file with testparm
|
||||
|
||||
It's important that you test the validity of your smb.conf file using
|
||||
the testparm program. If testparm runs OK then it will list the loaded
|
||||
services. If not it will give an error message.
|
||||
|
||||
Make sure it runs OK and that the services look resonable before
|
||||
proceeding.
|
||||
|
||||
STEP 5. Starting the smbd and nmbd.
|
||||
|
||||
You must choose to start smbd and nmbd either as daemons or from
|
||||
inetd. Don't try to do both! Either you can put them in inetd.conf
|
||||
and have them started on demand by inetd, or you can start them as
|
||||
daemons either from the command line or in /etc/rc.local. See the man
|
||||
pages for details on the command line options.
|
||||
|
||||
The main advantage of starting smbd and nmbd as a daemon is that they
|
||||
will respond slightly more quickly to an initial connection
|
||||
request. This is, however, unlilkely to be a problem.
|
||||
|
||||
Step 5a. Starting from inetd.conf
|
||||
|
||||
NOTE; The following will be different if you use NIS or NIS+ to
|
||||
distributed services maps.
|
||||
|
||||
Look at your /etc/services. What is defined at port 139/tcp. If
|
||||
nothing is defined then add a line like this:
|
||||
|
||||
netbios-ssn 139/tcp
|
||||
|
||||
similarly for 137/udp you should have an entry like:
|
||||
|
||||
netbios-ns 137/udp
|
||||
|
||||
Next edit your /etc/inetd.conf and add two lines something like this:
|
||||
|
||||
netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd
|
||||
netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd
|
||||
|
||||
The exact syntax of /etc/inetd.conf varies between unixes. Look at the
|
||||
other entries in inetd.conf for a guide.
|
||||
|
||||
NOTE: Some unixes already have entries like netbios_ns (note the
|
||||
underscore) in /etc/services. You must either edit /etc/services or
|
||||
/etc/inetd.conf to make them consistant.
|
||||
|
||||
NOTE: On many systems you may need to give the nmbd a -B parameter to
|
||||
specify the broadcast address of your interface. Run ifconfig as root
|
||||
if you don't know what the broadcast is for your net. nmbd tries to
|
||||
determine it at run time, but fails on some unixes. See the section on
|
||||
"testing nmbd" for a method of finding if you need to do this.
|
||||
|
||||
!!!WARNING!!! Many unixes only accept around 5 parameters on the
|
||||
command line in inetd. This means you shouldn't use spaces between the
|
||||
options and arguments, or you should use a script, and start the
|
||||
script from inetd.
|
||||
|
||||
Restart inetd, perhaps just send it a HUP. If you have installed an
|
||||
earlier version of nmbd then you may need to kill nmbd as well.
|
||||
|
||||
Step 5b. Alternative: starting it as a daemon
|
||||
|
||||
To start the server as a daemon you should create a script something
|
||||
like this one, perhaps calling it "startsmb"
|
||||
|
||||
#!/bin/sh
|
||||
/usr/local/samba/bin/smbd -D
|
||||
/usr/local/samba/bin/nmbd -D
|
||||
|
||||
then make it executable with "chmod +x startsmb"
|
||||
|
||||
You can then run startsmb by hand or execute it from /etc/rc.local
|
||||
|
||||
To kill it send a kill signal to the processes nmbd and smbd.
|
||||
|
||||
|
||||
|
||||
STEP 7. Try listing the shares available on your server
|
||||
|
||||
smbclient -L yourhostname
|
||||
|
||||
Your should get back a list of shares available on your server. If you
|
||||
don't then something is incorrectly setup. Note that this method can
|
||||
also be used to see what shares are available on other LanManager
|
||||
clients (such as WfWg).
|
||||
|
||||
If you choose user level security then you may find that Samba requests
|
||||
a password before it will list the shares. See the smbclient docs for
|
||||
details. (you can force it to list the shares without a password by
|
||||
adding the option -U% to the command line. This will not work with
|
||||
non-Samba servers)
|
||||
|
||||
STEP 8. try connecting with the unix client. eg:
|
||||
|
||||
smbclient '\\yourhostname\aservice'
|
||||
|
||||
Typically the "yourhostname" would be the name of the host where you
|
||||
installed smbd. The "aservice" is any service you have defined in the
|
||||
smb.conf file. Try your user name if you just have a [homes] section
|
||||
in smb.conf.
|
||||
|
||||
For example if your unix host is bambi and your login name is fred you
|
||||
would type:
|
||||
|
||||
smbclient '\\bambi\fred'
|
||||
|
||||
NOTE: The number of slashes to use depends on the type of shell you
|
||||
use. You may need '\\\\bambi\\fred' with some shells.
|
||||
|
||||
STEP 9. Try connecting from a dos/WfWg/Win95/NT/os-2 client. Try
|
||||
mounting disks. eg:
|
||||
|
||||
net use d: \\servername\service
|
||||
|
||||
Try printing. eg:
|
||||
|
||||
net use lpt1: \\servername\spoolservice
|
||||
print filename
|
||||
|
||||
Celebrate, or send me a bug report!
|
||||
|
||||
WHAT IF IT DOESN'T WORK?
|
||||
========================
|
||||
|
||||
If nothing works and you start to think "who wrote this pile of trash"
|
||||
then I suggest you do step 2 again (and again) till you calm down.
|
||||
|
||||
Then you might read the file DIAGNOSIS.txt and the FAQ. If you are
|
||||
still stuck then try the mailing list or newsgroup (look in the README
|
||||
for details). Samba has been successfully installed at thousands of
|
||||
sites worldwide, so maybe someone else has hit your problem and has
|
||||
overcome it. You could also use the WWW site to scan back issues of
|
||||
the samba-digest.
|
||||
|
||||
When you fix the problem PLEASE send me some updates to the
|
||||
documentation (or source code) so that the next person will find it
|
||||
easier.
|
||||
|
||||
DIAGNOSING PROBLEMS
|
||||
===================
|
||||
|
||||
If you have instalation problems then go to DIAGNOSIS.txt to try to
|
||||
find the problem.
|
||||
|
||||
SCOPE IDs
|
||||
=========
|
||||
|
||||
By default Samba uses a blank scope ID. This means all your windows
|
||||
boxes must also have a blank scope ID. If you really want to use a
|
||||
non-blank scope ID then you will need to use the -i <scope> option to
|
||||
nmbd, smbd, and smbclient. All your PCs will need to have the same
|
||||
setting for this to work. I do not recommend scope IDs.
|
||||
|
||||
|
||||
CHOOSING THE PROTOCOL LEVEL
|
||||
===========================
|
||||
|
||||
The SMB protocol has many dialects. Currently Samba supports 4, called
|
||||
CORE, COREPLUS, LANMAN1, LANMAN2 and NT1.
|
||||
|
||||
You can choose what protocols to support in the smb.conf file. The
|
||||
default is NT1 and that is the best for the vast majority of sites.
|
||||
|
||||
In older versions of Samba you may have found it necessary to use
|
||||
COREPLUS. The limitations that led to this have mostly been fixed. It
|
||||
is now less likely that you will want to use less than LANMAN1. The
|
||||
only remaining advantage of COREPLUS is that for some obscure reason
|
||||
WfWg preserves the case of passwords in this protocol, whereas under
|
||||
LANMAN1, LANMAN2 or NT1 it uppercases all passwords before sending them,
|
||||
forcing you to use the "password level=" option in some cases.
|
||||
|
||||
The main advantage of LANMAN2 and NT1 is support for long filenames with some
|
||||
clients (eg: smbclient, Windows NT or Win95).
|
||||
|
||||
See the smb.conf manual page for more details.
|
||||
|
||||
Note: To support print queue reporting you may find that you have to
|
||||
use TCP/IP as the default protocol under WfWg. For some reason if you
|
||||
leave Netbeui as the default it may break the print queue reporting on
|
||||
some systems. It is presumably a WfWg bug.
|
||||
|
||||
|
||||
PRINTING FROM UNIX TO A CLIENT PC
|
||||
=================================
|
||||
|
||||
To use a printer that is available via a smb-based server from a unix
|
||||
host you will need to compile the smbclient program. You then need to
|
||||
install the script "smbprint". Read the instruction in smbprint for
|
||||
more details.
|
||||
|
||||
There is also a SYSV style script that does much the same thing called
|
||||
smbprint.sysv. It contains instructions.
|
||||
|
||||
|
||||
LOCKING
|
||||
=======
|
||||
|
||||
One area which sometimes causes trouble is locking.
|
||||
|
||||
There are two types of locking which need to be performed by a SMB
|
||||
server. The first is "record locking" which allows a client to lock a
|
||||
range of bytes in a open file. The second is the "deny modes" that are
|
||||
specified when a file is open.
|
||||
|
||||
Samba supports "record locking" using the fcntl() unix system
|
||||
call. This is often implemented using rpc calls to a rpc.lockd process
|
||||
running on the system that owns the filesystem. Unfortunately many
|
||||
rpc.lockd implementations are very buggy, particularly when made to
|
||||
talk to versions from other vendors. It is not uncommon for the
|
||||
rpc.lockd to crash.
|
||||
|
||||
There is also a problem translating the 32 bit lock requests generated
|
||||
by PC clients to 31 bit requests supported by most
|
||||
unixes. Unfortunately many PC applications (typically OLE2
|
||||
applications) use byte ranges with the top bit set as semaphore
|
||||
sets. Samba attempts translation to support these types of
|
||||
applications, and the translation has proved to be quite successful.
|
||||
|
||||
Strictly a SMB server should check for locks before every read and
|
||||
write call on a file. Unfortunately with the way fcntl() works this
|
||||
can be slow and may overstress the rpc.lockd. It is also almost always
|
||||
unnecessary as clients are supposed to independently make locking
|
||||
calls before reads and writes anyway if locking is important to
|
||||
them. By default Samba only makes locking calls when explicitly asked
|
||||
to by a client, but if you set "strict locking = yes" then it will
|
||||
make lock checking calls on every read and write.
|
||||
|
||||
You can also disable by range locking completely using "locking =
|
||||
no". This is useful for those shares that don't support locking or
|
||||
don't need it (such as cdroms). In this case Samba fakes the return
|
||||
codes of locking calls to tell clients that everything is OK.
|
||||
|
||||
The second class of locking is the "deny modes". These are set by an
|
||||
application when it opens a file to determine what types of access
|
||||
should be allowed simultaneously with it's open. A client may ask for
|
||||
DENY_NONE, DENY_READ, DENY_WRITE or DENY_ALL. There are also special
|
||||
compatability modes called DENY_FCB and DENY_DOS.
|
||||
|
||||
You can disable share modes using "share modes = no". This may be
|
||||
useful on a heavily loaded server as the share modes code is very
|
||||
slow.
|
||||
|
||||
|
||||
MAPPING USERNAMES
|
||||
=================
|
||||
|
||||
If you have different usernames on the PCs and the unix server then
|
||||
take a look at the "username map" option. See the smb.conf man page
|
||||
for details.
|
28
docs/MIRRORS
Normal file
28
docs/MIRRORS
Normal file
@ -0,0 +1,28 @@
|
||||
The main Samba site is nimbus.anu.edu.au in pub/tridge/samba/. Contact
|
||||
samba-bugs@anu.edu.au for help with this site.
|
||||
|
||||
Mirror sites include:
|
||||
|
||||
|
||||
ftp://src.doc.ic.ac.uk/packages/samba
|
||||
ftp://ftp.warwick.ac.uk/pub/linux/sunsite.unc-mirror/system/Network/samba
|
||||
ftp://sunsite.unc.edu/pub/Linux/system/Network/samba/
|
||||
ftp://ftp.choc.apana.org.au/pub/samba
|
||||
ftp://ftp.uni-trier.de/pub/unix/network/samba/
|
||||
ftp://ftp.spectrum.titan.com/pub/samba
|
||||
ftp://ftp.demon.co.uk/pub/unix/unix/samba
|
||||
ftp://sunsite.mff.cuni.cz/Net/Protocols/Samba
|
||||
|
||||
There are several others. Give archie a try.
|
||||
|
||||
SCO binaries available from:
|
||||
ftp://ftp.markv.com/pub/samba (built by lance@fox.com)
|
||||
|
||||
AIX and DEC OSF/1 binaries are available from:
|
||||
ftp://151.99.220.5/pub/samba (built by davide.migliavacca@inferentia.inet.it)
|
||||
|
||||
|
||||
Http sites include:
|
||||
|
||||
http://lake.canberra.edu.au/pub/samba
|
||||
http://www.choc.apana.org.au/pub/samba
|
57
docs/OS2.txt
Normal file
57
docs/OS2.txt
Normal file
@ -0,0 +1,57 @@
|
||||
This describes how to use smbclient to connect to an OS/2 server.
|
||||
Knowing this allows you to use a OS/2 printer from unix.
|
||||
|
||||
Author: riiber@oslonett.no
|
||||
|
||||
|
||||
How to login to an OS/2 server
|
||||
-------------------------------
|
||||
|
||||
Sample setup for OS/2 server running LanMan 2.2:
|
||||
|
||||
OS/2 Server Name : \\OBV11
|
||||
OS/2 User Account : ARNE
|
||||
OS/2 Password : xxx
|
||||
OS/2 shared service 1 : LASER02
|
||||
OS/2 Shared service 2 : PCPROGS
|
||||
Samba NetBIOS name : KLATREMUS
|
||||
|
||||
First, the two servers were started with the commands
|
||||
smbd and nmbd -n KLATREMUS.
|
||||
|
||||
Command to connect to a the shared printer LASER02 on the OS/2 server:
|
||||
n
|
||||
smbclient '\\OBV11\LASER02' xxx -n ARNE -U ARNE -P
|
||||
|
||||
and to connect to the shared drive 'PCPROGS':
|
||||
|
||||
smbclient '\\OBV11\PCPROGS' xxx -n ARNE -U ARNE
|
||||
|
||||
|
||||
If login to the OS/2 server fails:
|
||||
----------------------------------
|
||||
|
||||
The remarkable OS/2 server requires NetBIOS name to be equal to User name.
|
||||
This was the only combination of (NetBIOS name, User name) that allowed login.
|
||||
|
||||
Password xxx must be in upper case, case in user name is unimportant.
|
||||
|
||||
The OS/2 server responds with "Bad password - name/password pair"
|
||||
if the password is illegal (in lowercase, for example).
|
||||
|
||||
If correct user name and password, but invalid NetBIOS name is given,
|
||||
it responds with "... SMBtcon failed. ERRDOS - 65".
|
||||
|
||||
The OS/2 server can disable login from a list of workstations (PCs)
|
||||
corresponding to the NetBIOS name (-n option). I set it up to
|
||||
allow login from any workstation.
|
||||
|
||||
|
||||
|
||||
(I experimented quite a lot with the -U and -n options, printed and browsed
|
||||
the MS SMB protocol docs and the RFC's, then read some comp.protocols.smb,
|
||||
got some tips, tried some "stupid" command line options,
|
||||
and at last I got it working!)
|
||||
|
||||
-Arne-
|
||||
|
81
docs/README.OS2
Normal file
81
docs/README.OS2
Normal file
@ -0,0 +1,81 @@
|
||||
Samba 1.9.15p8 for OS/2 : REQUIRES emx 0.9b.
|
||||
|
||||
|
||||
Please read the file README, which contains general information about
|
||||
the configuration and use of Samba.
|
||||
|
||||
|
||||
Notes specific to OS/2 port:
|
||||
============================
|
||||
|
||||
Filenames have been shortened to 8.3 in case anyone is using FAT.
|
||||
Files affected are:
|
||||
smb.conf -> smb.cfg smbclient -> smbclnt.exe
|
||||
smbstatus -> smbstat.exe nmblookup -> nmblook.exe
|
||||
|
||||
As I only use HPFS, I can't guarantee this will work on FAT systems,
|
||||
although I have tried to stick to 8.3 filenames. I have noticed some
|
||||
temporary files being created with long filenames by smbd when I tried
|
||||
printing (which does not work yet anyway). nmbd will not be able to
|
||||
create browse lists on FAT systems, as it uses temporary files with
|
||||
long file names.
|
||||
|
||||
smb.cfg should be in the directory smbd is started from. The path to
|
||||
smb.cfg is a compile time option, so if you are compiling from source
|
||||
you can set this to an absolute path to remove this restriction.
|
||||
|
||||
User home directories not supported. This doesn't make much sense on
|
||||
OS/2. I haven't actually disabled anything, so if you try setting
|
||||
this up, behaivour is undefined.
|
||||
|
||||
Password support is incomplete (I have found a crypt() routine, but
|
||||
lack of passwd file support in the EMX libraries make support difficult
|
||||
without major changes).
|
||||
|
||||
Printing does not appear to be working. OS/2's lpq gives output in a
|
||||
different format than the versions of lpq already supported by samba.
|
||||
This will be easy to accomodate, but there is not much point until I can
|
||||
get lpr working properly.
|
||||
|
||||
|
||||
|
||||
Source is available from the Samba WWW site :
|
||||
|
||||
http://lake.canberra.edu.au/pub/samba/
|
||||
|
||||
EMX 0.9b is available from hobbes.nmsu.edu, ftp.cdrom.com, ftp.leo.org and
|
||||
other OS/2 FTP sites. emxrt.zip contains the required libraries.
|
||||
|
||||
Bugs:
|
||||
=====
|
||||
|
||||
Known problems:
|
||||
===============
|
||||
|
||||
Printing does not work. I have tried using REXX scripts with path info
|
||||
built in, and watched the processes startup properly but nothing comes
|
||||
out of the printer (remote via lpr in this case).
|
||||
If you can get it going, please let me know how you did it.
|
||||
|
||||
The output from OS/2's lpq.exe is not understood by smbd, so all querys
|
||||
about the print queue say it is empty. Printing doesn't work anyway,
|
||||
so I have not attempted to fix this yet.
|
||||
|
||||
Temporary files are created with long filenames (when printing, and updating
|
||||
browse list)
|
||||
|
||||
Bug reports for the OS/2 port should be sent to Jason Rumney <jasonr@pec.co.nz>.
|
||||
|
||||
Change log:
|
||||
===========
|
||||
|
||||
Changes from release 1 to release 2.
|
||||
|
||||
nmblookup (nmblook.exe) is included, and works.
|
||||
|
||||
An attempt at password support was made using the gnuufc crypt routines,
|
||||
but then I found that a lot of functions in the EMX libraries to do with
|
||||
passwd files don't actually do anything.
|
||||
|
||||
Browse lists should now work if you use HPFS and set your lock directory
|
||||
to an absolute pathname.
|
99
docs/Warp.txt
Normal file
99
docs/Warp.txt
Normal file
@ -0,0 +1,99 @@
|
||||
Here is some advice from maxfield@ctelcom.uucp.netcom.com (Wade Maxfie
|
||||
to use Samba with OS/2 Warp.
|
||||
|
||||
Note that you may also find ftp://ftp.cdrom.com/pub/os2/new/os2net.faq
|
||||
useful.
|
||||
|
||||
|
||||
|
||||
Can I use Samba with Warp?
|
||||
|
||||
Yes. The MSClient software at ftp.microsoft.com in the Bussys
|
||||
(lanman os2 directory) will work, sort of. It is version 2.2c.
|
||||
|
||||
First, uncloack os2ver. (attrib -h -r -s c:\os2ver). It is a
|
||||
text file. change netwksta.xxx to 20=netwksta.sys. Also add
|
||||
20=setup.exe. Another change will be needed, a .vdd file. I remember
|
||||
it came up during the installation as being a wrong version. I wrote
|
||||
the name down, changed os2ver to include it, and restarted the
|
||||
installation.
|
||||
|
||||
Here is a copy of my os2ver
|
||||
|
||||
setup.exe
|
||||
netbios.os2
|
||||
nwifs.ifs
|
||||
netwksta.sys
|
||||
nwreq.sys
|
||||
netbios.sys
|
||||
ipx.sys
|
||||
netvdd.sys
|
||||
|
||||
Re-cloak os2ver. (attrib +h +r +s c:\os2ver)
|
||||
|
||||
Run the installation from an OS/2 Box. Note that your mouse wont work,
|
||||
use the TAB key to move around, enter to select hilighted items.
|
||||
|
||||
Here is a copy of my Config.sys file regarding the Laman entries.
|
||||
Note even though the version is 2.2c, it reports 2.2a in the text.
|
||||
|
||||
REM ==== LANMAN 2.2a == DO NOT MODIFY BETWEEN THESE LINES == LANMAN 2.
|
||||
DEVICE=C:\LANMAN\DRIVERS\PROTMAN\PROTMAN.OS2 /i:C:\LANMAN
|
||||
DEVICE=C:\LANMAN\DRIVERS\ETHERNET\Ns2000\Ns2000.OS2
|
||||
RUN=C:\LANMAN\DRIVERS\PROTOCOL\tcpip\starttcp.exe
|
||||
RUN=C:\LANMAN\DRIVERS\PROTOCOL\tcpip\startnb.exe
|
||||
DEVICE=C:\LANMAN\DRIVERS\PROTOCOL\tcpip\tcpdrv.os2
|
||||
DEVICE=C:\LANMAN\DRIVERS\PROTOCOL\tcpip\nbdrv.os2
|
||||
DEVICE=C:\LANMAN\DRIVERS\PROTOCOL\tcpip\nmdrv.os2
|
||||
DEVICE=C:\LANMAN\arpa\sockdrv.os2
|
||||
DEVICE=C:\LANMAN\DRIVERS\PROTOCOL\NETBEUI\NETBEUI.OS2
|
||||
DEVICE=C:\LANMAN\NETPROG\RDRHELP.SYS
|
||||
IFS=C:\LANMAN\NETPROG\NETWKSTA.SYS /i:C:\LANMAN
|
||||
DEVICE=C:\LANMAN\NETPROG\NETVDD.SYS
|
||||
REM ==== LANMAN 2.2a == DO NOT MODIFY BETWEEN THESE LINES == LANMAN 2.
|
||||
|
||||
|
||||
If you have an NE2000 card, don't reboot, or you'll be sorry.
|
||||
enable the automatic backup mechanism for recovering old config.sys and
|
||||
other files in OS/2. It paid for itself during this installation nightm
|
||||
before I knew better!)
|
||||
|
||||
Next, (or perhaps before this), if you have an NE2000 adaptor,
|
||||
get the ns2000 files from hobbes.nmsu.edu (in ns2000.zip). I manually
|
||||
patched protocol.ini to refer to that adaptor, and copied it into my
|
||||
c:\lanman directory. Note that I also modified the driver to be loaded
|
||||
in the config.sys to the ns2000.os2. It might install as an "other"
|
||||
adaptor.
|
||||
|
||||
A command file "startup.cmd" is placed in c:\. This file is
|
||||
automatically run when OS/2 Warp starts.
|
||||
Here is a copy of my startup file. Note that Warp sometimes fails to
|
||||
login properly to the server. I solve this by checking for the
|
||||
existance of a file, and rerunning the loing if that file fails to
|
||||
exist.
|
||||
|
||||
@REM ==== LANMAN 2.2a == DO NOT MODIFY BETWEEN THESE LINES == LANMAN
|
||||
NET START WORKSTATION
|
||||
:relogin
|
||||
NET LOGON maxfield mypassword /y
|
||||
rem net use f: \\packard90\d$
|
||||
rem net use g: \\linuxone\cdromsdir
|
||||
rem net use h: \\linuxone\public
|
||||
:doOver
|
||||
if not exist f:\wildcat\wildcat.exe goto relogin
|
||||
@REM ==== LANMAN 2.2a == DO NOT MODIFY BETWEEN THESE LINES == LANMAN
|
||||
exit
|
||||
|
||||
Finally, the system expects to be on a domain with a domain
|
||||
server. BTW, TCP/IP and NetBeui allow simultaneous communication with
|
||||
Os/2 lanserver 4.0, and Samba. (Note: Lanserver 4.0 won't yet to
|
||||
TCP/IP. (Well,it might, but it crashes before I get to that point, so I
|
||||
havent' been able to enable it))
|
||||
|
||||
I have not yet tried with only a SAMBA server on the domain.
|
||||
|
||||
I would be glad to try to answer any questions at above e-mail
|
||||
address, if I can.
|
||||
|
||||
wade
|
||||
|
398
docs/samba.faq
Normal file
398
docs/samba.faq
Normal file
@ -0,0 +1,398 @@
|
||||
|
||||
Frequently Asked Questions
|
||||
|
||||
about the
|
||||
|
||||
SAMBA Suite
|
||||
|
||||
(FAQ version 1.9.02, Samba version 1.09.02)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This FAQ was originally prepared by Karl Auer (Karl.Auer@anu.edu.au) and is
|
||||
currently maintained by Paul Blackman (ictinus@lake.canberra.edu.au).
|
||||
|
||||
As Karl originally said, 'this FAQ was prepared with lots of help from numerous
|
||||
net.helpers', and that's the way I'd like to keep it. So if you find anything
|
||||
that you think should be in here don't hesitate to contact me.
|
||||
|
||||
Thanks to Karl for the work he's done, and continuing thanks to Andrew Tridgell
|
||||
for developing Samba.
|
||||
|
||||
Note: This FAQ is (and probably always will be) under construction. Some
|
||||
sections exist only as optimistic entries in the Contents page.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Contents
|
||||
|
||||
* SECTION ONE: General information
|
||||
All about Samba - what it is, how to get it, related sources of
|
||||
information.
|
||||
* SECTION TWO: Compiling and installing Samba on a Unix host
|
||||
Common problems that arise when building and installing Samba under
|
||||
Unix.
|
||||
* SECTION THREE: Common client problems
|
||||
Common problems that arise when trying to communicate from a client
|
||||
computer to a Samba server. All problems which have symptoms you see
|
||||
at the client end will be in this section.
|
||||
* SECTION FOUR: Specific client problems
|
||||
This section covers problems that are specific to certain clients,
|
||||
such as Windows for Workgroups or Windows NT. Please check Section
|
||||
Three first!
|
||||
* SECTION FIVE: Specific client application problems
|
||||
This section covers problems that are specific to certain products,
|
||||
such as Windows for Workgroups or Windows NT. Please check Sections
|
||||
Three and Four first!
|
||||
* SECTION SIX: Miscellaneous
|
||||
All the questions that aren't classifiable into any other section.
|
||||
|
||||
|
||||
===============================================================================
|
||||
SECTION ONE: General information
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 1: What is Samba?
|
||||
|
||||
Samba is a suite of programs which work together to allow clients to access
|
||||
Unix filespace and printers via the SMB (Session Message Block) protocol.
|
||||
|
||||
In practice, this means that you can redirect disks and printers to Unix disks
|
||||
and printers from Lan Manager clients, Windows for Workgroups 3.11 clients,
|
||||
Windows NT clients and OS/2 clients. There is also a Unix client program
|
||||
supplied as part of the suite which allows Unix users to use an ftp-like
|
||||
interface to access filespace and printers on any other SMB servers.
|
||||
|
||||
The components of the suite are (in summary):
|
||||
|
||||
* smbd, the SMB server. This handles actual connections from clients
|
||||
* nmbd, the Netbios name server, which helps clients locate servers
|
||||
* smbclient, the Unix-hosted client program
|
||||
* smbrun, a little 'glue' program to help the server run external
|
||||
programs
|
||||
* testprns, a program to test server access to printers
|
||||
* testparms, a program to test the Samba configuration file for
|
||||
correctness
|
||||
* smb.conf, the Samba configuration file
|
||||
* smbprint, a sample script to allow a Unix host to use smbclient to
|
||||
print to an SMB server
|
||||
|
||||
The suite is supplied with full source (of course!) and is GPLed.
|
||||
|
||||
The primary creator of the Samba suite is Andrew Tridgell. Later versions
|
||||
incorporate much effort by many net.helpers. The man pages and this FAQ were
|
||||
written by Karl Auer.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 2: What is the current version of Samba?
|
||||
|
||||
At time of writing, the current version was 1.9.12. If you want to be sure
|
||||
check the bottom of the change-log file.
|
||||
(nimbus.anu.edu.au/pub/tridge/samba/change-log)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 3: Where can I get it?
|
||||
|
||||
The Samba suite is available via anonymous ftp from nimbus.anu.edu.au. The
|
||||
latest and greatest versions of the suite are in the directory:
|
||||
|
||||
/pub/tridge/samba/
|
||||
|
||||
Development (read "alpha") versions, which are NOT necessarily stable and which
|
||||
do NOT necessarily have accurate documentation, are available in the directory:
|
||||
|
||||
/pub/tridge/samba/alpha
|
||||
|
||||
Note that binaries are NOT included in any of the above. Samba is distributed
|
||||
ONLY in source form, though binaries may be available from other sites. Recent
|
||||
versions of some Linux distributions, for example, do contain Samba binaries
|
||||
for that platform.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 4: What platforms are supported?
|
||||
|
||||
Many different platforms have run Samba successfully. The platforms most widely
|
||||
used and thus best tested are Linux and SunOS.
|
||||
|
||||
At time of writing, the Makefile claimed support for:
|
||||
|
||||
* SunOS
|
||||
* Linux with shadow passwords
|
||||
* Linux without shadow passwords
|
||||
* SOLARIS
|
||||
* SOLARIS 2.2 and above (aka SunOS 5)
|
||||
* SVR4
|
||||
* ULTRIX
|
||||
* OSF1 (alpha only)
|
||||
* OSF1 with NIS and Fast Crypt (alpha only)
|
||||
* OSF1 V2.0 Enhanced Security (alpha only)
|
||||
* AIX
|
||||
* BSDI
|
||||
* NetBSD
|
||||
* NetBSD 1.0
|
||||
* SEQUENT
|
||||
* HP-UX
|
||||
* SGI
|
||||
* SGI IRIX 4.x.x
|
||||
* SGI IRIX 5.x.x
|
||||
* FreeBSD
|
||||
* NeXT 3.2 and above
|
||||
* NeXT OS 2.x
|
||||
* NeXT OS 3.0
|
||||
* ISC SVR3V4 (POSIX mode)
|
||||
* ISC SVR3V4 (iBCS2 mode)
|
||||
* A/UX 3.0
|
||||
* SCO with shadow passwords.
|
||||
* SCO with shadow passwords, without YP.
|
||||
* SCO with TCB passwords
|
||||
* SCO 3.2v2 (ODT 1.1) with TCP passwords
|
||||
* intergraph
|
||||
* DGUX
|
||||
* Apollo Domain/OS sr10.3 (BSD4.3)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 5: How can I find out more about Samba?
|
||||
|
||||
There are two mailing lists devoted to discussion of Samba-related matters.
|
||||
There is also the newsgroup, comp.protocols.smb, which has a great deal of
|
||||
discussion on Samba.
|
||||
|
||||
Send email to listproc@anu.edu.au. Make sure the subject line is blank, and
|
||||
include the following two lines in the body of the message:
|
||||
|
||||
subscribe samba Firstname Lastname
|
||||
subscribe samba-announce Firstname Lastname
|
||||
|
||||
Obviously you should substitute YOUR first name for "Firstname" and YOUR last
|
||||
name for "Lastname"! Try not to send any signature stuff, it sometimes confuses
|
||||
the list processor.
|
||||
|
||||
The samba list is a digest list - every eight hours or so it regurgitates a
|
||||
single message containing all the messages that have been received by the list
|
||||
since the last time and sends a copy of this message to all subscribers.
|
||||
|
||||
If you stop being interested in Samba, please send another email to
|
||||
listproc@anu.edu.au. Make sure the subject line is blank, and include the
|
||||
following two lines in the body of the message:
|
||||
|
||||
unsubscribe samba
|
||||
unsubscribe samba-announce
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 6: Something's gone wrong - what should I do?
|
||||
|
||||
[#] *** IMPORTANT! *** [#]
|
||||
DO NOT post messages on mailing lists or in newsgroups until you have carried
|
||||
out the first three steps given here!
|
||||
|
||||
Firstly, see if there are any likely looking entries in this FAQ!
|
||||
|
||||
Secondly, read the man pages for smbd, nmbd and smb.conf, looking for topics
|
||||
that relate to what you are trying to do.
|
||||
|
||||
Thirdly, if there is no obvious solution to hand, try to get a look at the log
|
||||
files for smbd and/or nmbd for the period during which you were having
|
||||
problems. You may need to reconfigure the servers to provide more extensive
|
||||
debugging information - usually level 2 or level 3 provide ample debugging
|
||||
info. Inspect these logs closely, looking particularly for the string "Error:".
|
||||
|
||||
If you successfully solve a problem, please mail me a succinct description of
|
||||
the symptom, the problem and the solution, so I can incorporate it in the next
|
||||
version of the FAQ.
|
||||
|
||||
|
||||
===============================================================================
|
||||
SECTION TWO: Compiling and installing Samba on a Unix host
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
===============================================================================
|
||||
SECTION THREE: Common client problems
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 1: I can't see the Samba server in any browse lists!
|
||||
|
||||
*** Until the FAQ can be updated, please check the file:
|
||||
*** ftp://nimbus.anu.adu.au/pub/tridge/samba/BROWSING.txt
|
||||
*** for more information on browsing.
|
||||
|
||||
If your GUI client does not permit you to select non-browsable servers, you may
|
||||
need to do so on the command line. For example, under Lan Manager you might
|
||||
connect to the above service as disk drive M: thusly:
|
||||
|
||||
net use M: \\mary\fred
|
||||
|
||||
The details of how to do this and the specific syntax varies from client to
|
||||
client - check your client's documentation.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 2: Some files that I KNOW are on the server doesn't show up when I view the
|
||||
directories from my client!
|
||||
|
||||
If you check what files are not showing up, you will note that they are files
|
||||
which contain upper case letters or which are otherwise not DOS-compatible (ie,
|
||||
they are not legal DOS filenames for some reason).
|
||||
|
||||
The Samba server can be configured either to ignore such files completely, or
|
||||
to present them to the client in "mangled" form. If you are not seeing the
|
||||
files at all, the Samba server has most likely been configured to ignore them.
|
||||
Consult the man page smb.conf(5) for details of how to change this - the
|
||||
parameter you need to set is "mangled names = yes".
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 3: Some files on the server show up with really wierd filenames when I view
|
||||
the directories from my client!
|
||||
|
||||
If you check what files are showing up wierd, you will note that they are files
|
||||
which contain upper case letters or which are otherwise not DOS-compatible (ie,
|
||||
they are not legal DOS filenames for some reason).
|
||||
|
||||
The Samba server can be configured either to ignore such files completely, or
|
||||
to present them to the client in "mangled" form. If you are seeing strange file
|
||||
names, they are most likely "mangled". If you would prefer to have such files
|
||||
ignored rather than presented in "mangled" form, consult the man page
|
||||
smb.conf(5) for details of how to change the server configuration - the
|
||||
parameter you need to set is "mangled names = no".
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 4: My client reports "cannot locate specified computer" or similar.
|
||||
|
||||
This indicates one of three things: You supplied an incorrect server name, the
|
||||
underlying TCP/IP layer is not working correctly, or the name you specified
|
||||
cannot be resolved.
|
||||
|
||||
After carefully checking that the name you typed is the name you should have
|
||||
typed, try doing things like pinging a host or telnetting to somewhere on your
|
||||
network to see if TCP/IP is functioning OK. If it is, the problem is most
|
||||
likely name resolution.
|
||||
|
||||
If your client has a facility to do so, hardcode a mapping between the hosts IP
|
||||
and the name you want to use. For example, with Man Manager or Windows for
|
||||
Workgroups you would put a suitable entry in the file LMHOSTS. If this works,
|
||||
the problem is in the communication between your client and the netbios name
|
||||
server. If it does not work, then there is something fundamental wrong with
|
||||
your naming and the solution is beyond the scope of this document.
|
||||
|
||||
If you do not have any server on your subnet supplying netbios name resolution,
|
||||
hardcoded mappings are your only option. If you DO have a netbios name server
|
||||
running (such as the Samba suite's nmbd program), the problem probably lies in
|
||||
the way it is set up. Refer to Section Two of this FAQ for more ideas.
|
||||
|
||||
By the way, remember to REMOVE the hardcoded mapping before further tests :-)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 5: My client reports "cannot locate specified share name" or similar.
|
||||
|
||||
This message indicates that your client CAN locate the specified server, which
|
||||
is a good start, but that it cannot find a service of the name you gave.
|
||||
|
||||
The first step is to check the exact name of the service you are trying to
|
||||
connect to (consult your system administrator). Assuming it exists and you
|
||||
specified it correctly (read your client's doco on how to specify a service
|
||||
name correctly), read on:
|
||||
|
||||
* Many clients cannot accept or use service names longer than eight
|
||||
characters.
|
||||
* Many clients cannot accept or use service names containing spaces.
|
||||
* Some servers (not Samba though) are case sensitive with service names.
|
||||
* Some clients force service names into upper case.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 6: My client reports "cannot find domain controller", "cannot log on to the
|
||||
network" or similar.
|
||||
|
||||
Nothing is wrong - Samba does not implement the primary domain name controller
|
||||
stuff for several reasons, including the fact that the whole concept of a
|
||||
primary domain controller and "logging in to a network" doesn't fit well with
|
||||
clients possibly running on multiuser machines (such as users of smbclient
|
||||
under Unix).
|
||||
|
||||
Seeing this message should not affect your ability to mount redirected disks
|
||||
and printers, which is really what all this is about.
|
||||
|
||||
For many clients (including Windows for Workgroups and Lan Manager), setting
|
||||
the domain to STANDALONE at least gets rid of the message.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 7: Printing doesn't work :-(
|
||||
|
||||
Make sure that the specified print command for the service you are connecting
|
||||
to is correct and that it has a fully-qualified path (eg., use "/usr/bin/lpr"
|
||||
rather than just "lpr").
|
||||
|
||||
Make sure that the spool directory specified for the service is writable by the
|
||||
user connected to the service. In particular the user "nobody" often has
|
||||
problems with printing, even if it worked with an earlier version of Samba. Try
|
||||
creating another guest user other than "nobody".
|
||||
|
||||
Make sure that the user specified in the service is permitted to use the
|
||||
printer.
|
||||
|
||||
Check the debug log produced by smbd. Search for the printer name and see if
|
||||
the log turns up any clues. Note that error messages to do with a service ipc$
|
||||
are meaningless - they relate to the way the client attempts to retrieve status
|
||||
information when using the LANMAN1 protocol.
|
||||
|
||||
If using WfWg then you need to set the default protocol to TCP/IP, not Netbeui.
|
||||
This is a WfWg bug.
|
||||
|
||||
If using the Lanman1 protocol (the default) then try switching to coreplus.
|
||||
Also not that print status error messages don't mean printing won't work. The
|
||||
print status is received by a different mechanism.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 8: My programs install on the server OK, but refuse to work properly.
|
||||
|
||||
There are numerous possible reasons for this, but one MAJOR possibility is that
|
||||
your software uses locking. Make sure you are using Samba 1.6.11 or later. It
|
||||
may also be possible to work around the problem by setting "locking=no" in the
|
||||
Samba configuration file for the service the software is installed on. This
|
||||
should be regarded as a strictly temporary solution.
|
||||
|
||||
In earlier Samba versions there were some difficulties with the very latest
|
||||
Microsoft products, particularly Excel 5 and Word for Windows 6. These should
|
||||
have all been solved. If not then please let Andrew Tridgell know.
|
||||
|
||||
|
||||
===============================================================================
|
||||
SECTION FOUR: Specific client problems
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* 1: Are any MacIntosh clients for Samba.
|
||||
|
||||
In Rob Newberry's words (rob@eats.com, Sun, 4 Dec 1994):
|
||||
|
||||
The answer is "No." Samba speaks SMB, the protocol used for Microsoft networks.
|
||||
The Macintosh has ALWAYS spoken Appletalk. Even with Microsoft "services for
|
||||
Macintosh", it has been a matter of making the server speak Appletalk. It is
|
||||
the same for Novell Netware and the Macintosh, although I believe Novell has
|
||||
(VERY LATE) released an extension for the Mac to let it speak IPX.
|
||||
|
||||
In future Apple System Software, you may see support for other protocols, such
|
||||
as SMB -- Applet is working on a new networking architecture that will make it
|
||||
easier to support additional protocols. But it's not here yet.
|
||||
|
||||
Now, the nice part is that if you want your Unix machine to speak Appletalk,
|
||||
there are several options. "Netatalk" and "CAP" are free, and available on the
|
||||
net. There are also several commercial options, such as "PacerShare" and
|
||||
"Helios" (I think). In any case, you'll have to look around for a server, not
|
||||
anything for the Mac.
|
||||
|
||||
Depending on you OS, some of these may not help you. I am currently
|
||||
coordinating the effort to get CAP working with Native Ethertalk under Linux,
|
||||
but we're not done yet.
|
||||
|
||||
Rob
|
||||
|
||||
|
||||
===============================================================================
|
||||
SECTION FIVE: Specific client application problems
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
===============================================================================
|
||||
SECTION SIX: Miscellaneous
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Maintained By Paul Blackman, Email:ictinus@lake.canberra.edu.au
|
||||
|
||||
|
160
source/loadparm.h
Normal file
160
source/loadparm.h
Normal file
@ -0,0 +1,160 @@
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 1.9.
|
||||
Parameter loading functions
|
||||
Copyright (C) Karl Auer 1993, 1994
|
||||
|
||||
Extensively modified by Andrew Tridgell
|
||||
|
||||
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 Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Prototypes etc for loadparm.c.
|
||||
*
|
||||
*/
|
||||
#ifndef _LOADPARM_H
|
||||
#define _LOADPARM_H
|
||||
|
||||
#include "smb.h"
|
||||
|
||||
extern BOOL lp_file_list_changed(void);
|
||||
extern void lp_killunused(BOOL (*snumused)(int ));
|
||||
extern BOOL lp_loaded(void);
|
||||
extern BOOL lp_snum_ok(int iService);
|
||||
extern BOOL lp_manglednames(int iService);
|
||||
extern char *lp_passwordserver(void);
|
||||
extern char *lp_passwd_program(void);
|
||||
extern char *lp_passwd_chat(void);
|
||||
extern char *lp_guestaccount(int iService);
|
||||
extern char *lp_printcapname(void);
|
||||
extern char *lp_lockdir(void);
|
||||
extern char *lp_logfile(void);
|
||||
extern char *lp_configfile(void);
|
||||
extern char *lp_smb_passwd_file(void);
|
||||
extern char *lp_rootdir(void);
|
||||
extern char *lp_defaultservice(void);
|
||||
extern char *lp_serverstring(void);
|
||||
extern char *lp_dfree_command(void);
|
||||
extern char *lp_msg_command(void);
|
||||
extern char *lp_workgroup(void);
|
||||
extern char *lp_domain_controller(void);
|
||||
extern char *lp_username_map(void);
|
||||
extern char *lp_hosts_equiv(void);
|
||||
extern char *lp_logon_script(void);
|
||||
extern char *lp_magicscript(int iService);
|
||||
extern char *lp_magicoutput(int iService);
|
||||
extern char *lp_mangled_map(int iService);
|
||||
char *volume_label(int snum);
|
||||
extern int lp_os_level(void);
|
||||
extern int lp_max_ttl(void);
|
||||
extern int lp_max_log_size(void);
|
||||
extern int lp_maxxmit(void);
|
||||
extern int lp_maxmux(void);
|
||||
extern int lp_mangledstack(void);
|
||||
extern BOOL lp_preferred_master(void);
|
||||
extern BOOL lp_domain_master(void);
|
||||
extern BOOL lp_domain_logons(void);
|
||||
extern BOOL lp_getwdcache(void);
|
||||
extern BOOL lp_use_rhosts(void);
|
||||
extern BOOL lp_readprediction(void);
|
||||
extern BOOL lp_readbmpx(void);
|
||||
extern BOOL lp_readraw(void);
|
||||
extern BOOL lp_writeraw(void);
|
||||
extern BOOL lp_null_passwords(void);
|
||||
extern BOOL lp_strip_dot(void);
|
||||
extern BOOL lp_encrypted_passwords(void);
|
||||
extern BOOL lp_syslog_only(void);
|
||||
extern BOOL lp_browse_list(void);
|
||||
extern int lp_numservices(void);
|
||||
extern int lp_keepalive(void);
|
||||
extern int lp_passwordlevel(void);
|
||||
extern int lp_security(void);
|
||||
extern int lp_printing(void);
|
||||
extern int lp_maxdisksize(void);
|
||||
extern int lp_lpqcachetime(void);
|
||||
extern int lp_syslog(void);
|
||||
extern int lp_deadtime(void);
|
||||
extern int lp_debuglevel(void);
|
||||
extern int lp_maxprotocol(void);
|
||||
extern int lp_maxpacket(void);
|
||||
extern char *lp_comment(int iService);
|
||||
extern char *lp_preexec(int iService);
|
||||
extern char *lp_postexec(int iService);
|
||||
extern char *lp_rootpreexec(int iService);
|
||||
extern char *lp_rootpostexec(int iService);
|
||||
extern char *lp_servicename(int iService);
|
||||
extern char *lp_pathname(int iService);
|
||||
extern char *lp_username(int iService);
|
||||
extern char *lp_invalid_users(int iService);
|
||||
extern char *lp_valid_users(int iService);
|
||||
extern char *lp_admin_users(int iService);
|
||||
extern char *lp_printcommand(int iService);
|
||||
extern char *lp_lpqcommand(int iService);
|
||||
extern char *lp_lprmcommand(int iService);
|
||||
extern char *lp_lppausecommand(int iService);
|
||||
extern char *lp_lpresumecommand(int iService);
|
||||
extern char *lp_printername(int iService);
|
||||
extern char *lp_hostsallow(int iService);
|
||||
extern char *lp_hostsdeny(int iService);
|
||||
extern char *lp_dontdescend(int iService);
|
||||
extern char *lp_force_user(int iService);
|
||||
extern char *lp_force_group(int iService);
|
||||
extern char *lp_readlist(int iService);
|
||||
extern char *lp_writelist(int iService);
|
||||
extern BOOL lp_alternate_permissions(int iService);
|
||||
extern BOOL lp_revalidate(int iService);
|
||||
extern BOOL lp_status(int iService);
|
||||
extern BOOL lp_hide_dot_files(int iService);
|
||||
extern BOOL lp_browseable(int iService);
|
||||
extern BOOL lp_widelinks(int iService);
|
||||
extern BOOL lp_syncalways(int iService);
|
||||
extern BOOL lp_readonly(int iService);
|
||||
extern BOOL lp_no_set_dir(int iService);
|
||||
extern BOOL lp_guest_ok(int iService);
|
||||
extern BOOL lp_guest_only(int iService);
|
||||
extern BOOL lp_print_ok(int iService);
|
||||
extern BOOL lp_postscript(int iService);
|
||||
extern BOOL lp_map_hidden(int iService);
|
||||
extern BOOL lp_map_archive(int iService);
|
||||
extern BOOL lp_locking(int iService);
|
||||
extern BOOL lp_strict_locking(int iService);
|
||||
extern BOOL lp_share_modes(int iService);
|
||||
extern BOOL lp_onlyuser(int iService);
|
||||
extern BOOL lp_map_system(int iService);
|
||||
extern BOOL lp_casesensitive(int iService);
|
||||
extern BOOL lp_casemangle(int iService);
|
||||
extern BOOL lp_preservecase(int iService);
|
||||
extern BOOL lp_shortpreservecase(int iService);
|
||||
extern BOOL lp_load(char *pszFname,BOOL global_only);
|
||||
extern void lp_dump(void);
|
||||
extern int lp_servicenumber(char *pszServiceName);
|
||||
extern BOOL lp_add_home(char *pszHomename,
|
||||
int iDefaultService, char *pszHomedir);
|
||||
extern int lp_add_service(char *service, int iDefaultService);
|
||||
extern BOOL lp_add_printer(char *pszPrintername, int iDefaultService);
|
||||
extern BOOL lp_readonly(int iService);
|
||||
extern int lp_create_mode(int iService);
|
||||
extern int lp_minprintspace(int iService);
|
||||
extern int lp_defaultcase(int iService);
|
||||
extern char lp_magicchar(int iService);
|
||||
extern int lp_max_connections(int iService);
|
||||
extern BOOL lp_add_home(char *pservice,int ifrom,char *phome);
|
||||
extern char *lp_string(char *s);
|
||||
char *my_workgroup(void);
|
||||
|
||||
#endif
|
||||
|
45
source/params.h
Normal file
45
source/params.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 1.9.
|
||||
Parameter loading utilities
|
||||
Copyright (C) Karl Auer 1993, 1994
|
||||
|
||||
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 Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
PARAMS.H
|
||||
|
||||
Copyright (C) 1990, 1991, 1992 Karl Auer
|
||||
|
||||
Prototypes and definitions for PARAMS.C.
|
||||
**************************************************************************/
|
||||
#ifndef _PARAMS_H
|
||||
#define _PARAMS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "smb.h"
|
||||
|
||||
typedef BOOL (* PM_PARMFUNC)(char *pszParmName, char *pszParmValue);
|
||||
typedef BOOL (* PM_SECFUNC)(char *pszSectionName);
|
||||
|
||||
#define PM_NOFILE 1
|
||||
#define PM_NOFILENAME 2
|
||||
#define PM_FILEERROR 3
|
||||
|
||||
extern BOOL pm_process(char *pszFileName, PM_SECFUNC sfunc, PM_PARMFUNC pfunc);
|
||||
|
||||
#endif
|
||||
|
35
source/pcap.h
Normal file
35
source/pcap.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 1.9.
|
||||
printcap parsing
|
||||
Copyright (C) Karl Auer 1993, 1994
|
||||
|
||||
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 Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Prototypes etc for pcap.c.
|
||||
*
|
||||
*/
|
||||
#ifndef _PCAP_H
|
||||
#define _PCAP_H
|
||||
|
||||
#include "smb.h"
|
||||
|
||||
extern BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname);
|
||||
extern void pcap_printer_fn(void (*fn)());
|
||||
|
||||
#endif
|
60
source/reply.h
Normal file
60
source/reply.h
Normal file
@ -0,0 +1,60 @@
|
||||
int reply_special(char *inbuf,char *outbuf);
|
||||
int reply_corep(char *outbuf);
|
||||
int reply_coreplus(char *outbuf);
|
||||
int reply_nt1(char *outbuf);
|
||||
int reply_lanman1(char *outbuf);
|
||||
int reply_lanman2(char *outbuf);
|
||||
int reply_tcon(char *inbuf,char *outbuf);
|
||||
int reply_tcon_and_X(char *inbuf,char *outbuf,int length,int bufsize);
|
||||
int reply_unknown(char *inbuf,char *outbuf);
|
||||
int reply_ioctl(char *inbuf,char *outbuf);
|
||||
int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize);
|
||||
int reply_chkpth(char *inbuf,char *outbuf);
|
||||
int reply_getatr(char *inbuf,char *outbuf);
|
||||
int reply_setatr(char *inbuf,char *outbuf);
|
||||
int reply_dskattr(char *inbuf,char *outbuf);
|
||||
int reply_search(char *inbuf,char *outbuf);
|
||||
int reply_fclose(char *inbuf,char *outbuf);
|
||||
int reply_open(char *inbuf,char *outbuf);
|
||||
int reply_open_and_X(char *inbuf,char *outbuf,int length,int bufsize);
|
||||
int reply_ulogoffX(char *inbuf,char *outbuf,int length,int bufsize);
|
||||
int reply_mknew(char *inbuf,char *outbuf);
|
||||
int reply_ctemp(char *inbuf,char *outbuf);
|
||||
int reply_unlink(char *inbuf,char *outbuf);
|
||||
int reply_readbraw(char *inbuf, char *outbuf);
|
||||
int reply_lockread(char *inbuf,char *outbuf);
|
||||
int reply_read(char *inbuf,char *outbuf);
|
||||
int reply_read_and_X(char *inbuf,char *outbuf,int length,int bufsize);
|
||||
int reply_writebraw(char *inbuf,char *outbuf);
|
||||
int reply_writeunlock(char *inbuf,char *outbuf);
|
||||
int reply_write(char *inbuf,char *outbuf,int dum1,int dum2);
|
||||
int reply_write_and_X(char *inbuf,char *outbuf,int length,int bufsize);
|
||||
int reply_lseek(char *inbuf,char *outbuf);
|
||||
int reply_flush(char *inbuf,char *outbuf);
|
||||
int reply_exit(char *inbuf,char *outbuf);
|
||||
int reply_close(char *inbuf,char *outbuf);
|
||||
int reply_writeclose(char *inbuf,char *outbuf);
|
||||
int reply_lock(char *inbuf,char *outbuf);
|
||||
int reply_unlock(char *inbuf,char *outbuf);
|
||||
int reply_tdis(char *inbuf,char *outbuf);
|
||||
int reply_echo(char *inbuf,char *outbuf);
|
||||
int reply_printopen(char *inbuf,char *outbuf);
|
||||
int reply_printclose(char *inbuf,char *outbuf);
|
||||
int reply_printqueue(char *inbuf,char *outbuf);
|
||||
int reply_printwrite(char *inbuf,char *outbuf);
|
||||
int reply_mkdir(char *inbuf,char *outbuf);
|
||||
int reply_rmdir(char *inbuf,char *outbuf);
|
||||
int reply_mv(char *inbuf,char *outbuf);
|
||||
int reply_copy(char *inbuf,char *outbuf);
|
||||
int reply_setdir(char *inbuf,char *outbuf);
|
||||
int reply_lockingX(char *inbuf,char *outbuf,int length,int bufsize);
|
||||
int reply_readbmpx(char *inbuf,char *outbuf,int length,int bufsize);
|
||||
int reply_writebmpx(char *inbuf,char *outbuf);
|
||||
int reply_setattrE(char *inbuf,char *outbuf);
|
||||
int reply_getattrE(char *inbuf,char *outbuf);
|
||||
int reply_writebs(char *inbuf,char *outbuf);
|
||||
int reply_sends(char *inbuf,char *outbuf);
|
||||
int reply_sendstrt(char *inbuf,char *outbuf);
|
||||
int reply_sendend(char *inbuf,char *outbuf);
|
||||
int reply_sendtxt(char *inbuf,char *outbuf);
|
||||
int reply_transs2(char *inbuf,char *outbuf,int length,int bufsize);
|
50
source/smbpass.h
Normal file
50
source/smbpass.h
Normal file
@ -0,0 +1,50 @@
|
||||
#ifndef _SMBPASS_H_
|
||||
#define _SMBPASS_H_
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 1.9.
|
||||
SMB parameters and setup
|
||||
Copyright (C) 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 Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
struct smb_passwd {
|
||||
int smb_userid;
|
||||
char *smb_name;
|
||||
unsigned char *smb_passwd; /* Null if no password */
|
||||
unsigned char *smb_nt_passwd; /* Null if no password */
|
||||
/* Other fields / flags may be added later */
|
||||
};
|
||||
|
||||
/* Return a smb_passwd struct given a user name, 0 if fails. */
|
||||
struct smb_passwd *get_smbpwnam(char *user);
|
||||
|
||||
#ifndef uchar
|
||||
#define uchar unsigned char
|
||||
#endif
|
||||
|
||||
/* SMB Encryption functions. */
|
||||
void str_to_key(unsigned char *str,unsigned char *key);
|
||||
void E_P16(uchar *p14,uchar *p16);
|
||||
void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
|
||||
void E_md4hash(uchar *passwd,uchar *p16);
|
||||
void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
|
||||
void SMB_nt_encrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
|
||||
|
||||
/* Password file lock/unlock routines */
|
||||
int pw_file_lock(char *name, int type, int secs);
|
||||
int pw_file_unlock(int fd);
|
||||
#endif
|
302
source/sockspy.c
Normal file
302
source/sockspy.c
Normal file
@ -0,0 +1,302 @@
|
||||
/*
|
||||
USAGE
|
||||
sockspy desthost destservice
|
||||
|
||||
You install this program in /etc/inetd.conf and /etc/services
|
||||
|
||||
For example I have used these entries:
|
||||
|
||||
/etc/services:
|
||||
spy 8001/tcp spy port
|
||||
|
||||
/etc/inetd.conf:
|
||||
spy stream tcp nowait tridge /usr/local/smb/sockspy sockspy fjall netbios-ssn
|
||||
|
||||
This means any connection to port 8001 will be redirected to
|
||||
netbios-ssn on fjall. By playing with these parameters you can easily
|
||||
spy on most of the tcp protocols. All packets traversing the link will
|
||||
be captured.
|
||||
|
||||
NOTE: This program is totally unsupported. I haven't used it for 2
|
||||
years, and don't intend to fix the obvious bugs/limitations. I will,
|
||||
however, accept contributed patches - or even a total rewrite :-)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/dir.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <sysexits.h>
|
||||
|
||||
int trans_num = 0;
|
||||
|
||||
#ifndef LOGIN
|
||||
#define LOGIN "/tmp/spy.in"
|
||||
#endif
|
||||
|
||||
#ifndef LOGOUT
|
||||
#define LOGOUT "/tmp/spy.out"
|
||||
#endif
|
||||
|
||||
#ifndef LOGCMD
|
||||
#define LOGCMD "/tmp/spy.cmd"
|
||||
#endif
|
||||
|
||||
FILE *cmd = NULL;
|
||||
FILE *login = NULL;
|
||||
FILE *logout = NULL;
|
||||
|
||||
#define STREQL(a, b) (strcmp(a, b) == 0)
|
||||
#define NIL (0)
|
||||
|
||||
char DestHost[256]; /* Remote system to connect to */
|
||||
char DestObj[256]; /* Remote object/service to connect to */
|
||||
|
||||
/* Signal handler for SIGPIPE (write on a disconnected socket) */
|
||||
abort()
|
||||
{
|
||||
if (cmd)
|
||||
{
|
||||
fprintf(cmd,"writing to disconnected socket!\n");
|
||||
fflush(cmd);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
main(argc, argv)
|
||||
int argc; /* # of command line arguments */
|
||||
char *argv[]; /* the command line arguments */
|
||||
{
|
||||
int client, /* Socket connected to client */
|
||||
server; /* Socket to use for server */
|
||||
|
||||
trans_num = 0;
|
||||
#ifndef NOLOG
|
||||
login = fopen(LOGIN,"w");
|
||||
logout = fopen(LOGOUT,"w");
|
||||
cmd = fopen(LOGCMD,"w");
|
||||
#endif
|
||||
|
||||
if (cmd)
|
||||
{
|
||||
fprintf(cmd,"Started server\n");
|
||||
fflush(cmd);
|
||||
}
|
||||
|
||||
/* Check usage */
|
||||
if(argc != 3)
|
||||
return;
|
||||
|
||||
strcpy(DestHost,argv[1]);
|
||||
strcpy(DestObj,argv[2]);
|
||||
|
||||
/* Time to attempt the connection */
|
||||
server = inet_conn(DestHost, DestObj);
|
||||
|
||||
if( server < 0 ) {
|
||||
exit(EX_CANTCREAT);
|
||||
}
|
||||
|
||||
/* Just to make the code more readable */
|
||||
client = 0;
|
||||
|
||||
/* We will abort gracefully when the client or remote system
|
||||
goes away */
|
||||
signal(SIGPIPE, abort);
|
||||
|
||||
/* Now just go and move raw data between client and
|
||||
remote system */
|
||||
dowork(client, server);
|
||||
/* ... NEVER RETURNS ... */
|
||||
}
|
||||
|
||||
dowork(client, server)
|
||||
int client, server;
|
||||
{
|
||||
|
||||
/* select(2) masks for client and remote */
|
||||
int ClientMask, ServerMask;
|
||||
|
||||
/* Combined ClientMask and ServerMask */
|
||||
int ReadMask;
|
||||
|
||||
/* Initialize select(2) masks */
|
||||
ClientMask = 1<<client;
|
||||
ServerMask = 1<<server;
|
||||
|
||||
ReadMask = ClientMask | ServerMask;
|
||||
|
||||
/* Now move raw data for the rest of our life between
|
||||
client and remote */
|
||||
for( ; ; ) {
|
||||
/* Local Variables */
|
||||
int SelectReadMask;/* select(2) mask modifiable by select(2) */
|
||||
int nready; /* status return from select(2) */
|
||||
|
||||
do {
|
||||
/* Intialize select(2) mask everytime
|
||||
as select(2) always modifies it */
|
||||
SelectReadMask = ReadMask;
|
||||
|
||||
/* Wait for data to be present to be moved */
|
||||
errno = 0;
|
||||
nready = select(32,&SelectReadMask,(int *)0,(int *)0,NIL);
|
||||
} while( nready < 0 && errno == EINTR );
|
||||
|
||||
/* select(2) failed, shouldn't happen. Exit abnormally */
|
||||
if( nready < 0 )
|
||||
exit(EX_SOFTWARE);
|
||||
|
||||
/* Favor the client (for no particular reason)
|
||||
if s/he is has data */
|
||||
if( SelectReadMask & ClientMask )
|
||||
{
|
||||
if (cmd)
|
||||
fprintf(cmd,"client %d\n",nready);
|
||||
xfer(client, server,login);
|
||||
}
|
||||
|
||||
/* Then check on the other guy */
|
||||
if( SelectReadMask & ServerMask )
|
||||
{
|
||||
if (cmd)
|
||||
fprintf(cmd,"server %d\n",nready);
|
||||
xfer(server, client,logout);
|
||||
}
|
||||
}
|
||||
|
||||
/* NEVER REACHED */
|
||||
}
|
||||
|
||||
#define BUFSIZE 20000 /* Max bytes to move at a time */
|
||||
|
||||
xfer(from, to,file)
|
||||
int from, to; /* Move data from "from" to "to" */
|
||||
FILE *file;
|
||||
{
|
||||
static char buf[BUFSIZE]; /* Buffer data to be moved */
|
||||
int nready; /* # bytes readable */
|
||||
int got; /* # bytes actually being moved */
|
||||
int ret;
|
||||
|
||||
/* Query the system how many bytes are ready to be read */
|
||||
ioctl(from, FIONREAD, &nready);
|
||||
|
||||
if (cmd)
|
||||
fprintf(cmd,"nready = %d\n",nready);
|
||||
|
||||
/* Only try to get the smaller of nready and BUFSIZE */
|
||||
got = read(from, buf, nready < BUFSIZE ? nready : BUFSIZE);
|
||||
|
||||
/* Zero bytes returned indicates end of stream, exit gracefully */
|
||||
if( got == 0 )
|
||||
{
|
||||
if (cmd)
|
||||
{
|
||||
fprintf(cmd,"read 0 bytes exiting\n");
|
||||
fflush(cmd);
|
||||
}
|
||||
if (login)
|
||||
fclose(login);
|
||||
if (logout)
|
||||
fclose(logout);
|
||||
if (cmd)
|
||||
fclose(cmd);
|
||||
exit(EX_OK);
|
||||
}
|
||||
|
||||
|
||||
if (file)
|
||||
{
|
||||
fprintf(file,"\nTransaction %d\n",trans_num);
|
||||
fwrite(buf,got,1,file);
|
||||
fflush(file);
|
||||
}
|
||||
trans_num++;
|
||||
|
||||
/* Now send it accross to the other side */
|
||||
ret = write(to, buf, got);
|
||||
|
||||
if (cmd)
|
||||
{
|
||||
fprintf(cmd,"wrote %d\n",ret);
|
||||
if (ret < 0)
|
||||
fprintf(cmd,"error = %s\n",strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
inet_conn(host, port)
|
||||
char *host;
|
||||
char *port;
|
||||
{
|
||||
/* Local Vars */
|
||||
int sock; /* Socket to use for the connection */
|
||||
struct hostent *hostent; /* Destination host entry */
|
||||
struct servent *servent; /* Destination service entry */
|
||||
struct sockaddr_in addr; /* Formated destination for connect */
|
||||
|
||||
/* Fetch the requested host and service entries */
|
||||
hostent = gethostbyname(host);
|
||||
if (isdigit(*port))
|
||||
servent = getservbyport(80, "tcp");
|
||||
else
|
||||
servent = getservbyname(port, "tcp");
|
||||
|
||||
|
||||
if (cmd)
|
||||
{
|
||||
fprintf(cmd,"inet_conn %s %s\n",host,port);
|
||||
|
||||
if (servent == NULL)
|
||||
fprintf(cmd,"servent is NIL\n");
|
||||
if (hostent == NULL)
|
||||
fprintf(cmd,"hostent is NIL\n");
|
||||
if (hostent->h_addrtype != AF_INET)
|
||||
fprintf(cmd,"not inet type\n");
|
||||
fflush(cmd);
|
||||
}
|
||||
|
||||
|
||||
/* No host entry, no service entry, or host is not
|
||||
Internet, error! */
|
||||
if( servent == NIL ||
|
||||
hostent == NIL ||
|
||||
hostent->h_addrtype != AF_INET )
|
||||
return -1;
|
||||
|
||||
/* Get a socket from the system to use for the connection */
|
||||
if( (sock = socket(AF_INET, SOCK_STREAM, 0)) < 0 )
|
||||
return -1;
|
||||
|
||||
/* Make sure we start with a clean address structure ... */
|
||||
bzero(&addr, sizeof(addr));
|
||||
|
||||
/* ... then fill in the required fields */
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = servent->s_port;
|
||||
bcopy(hostent->h_addr, &addr.sin_addr, hostent->h_length);
|
||||
|
||||
/* Now try to connection to the destination */
|
||||
if( connect(sock, &addr, sizeof(addr)) < 0 ) {
|
||||
/* No go, release the socket, and then return error! */
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Success. Return the connected socket descriptor */
|
||||
if (cmd)
|
||||
fprintf(cmd,"returning %d\n",sock);
|
||||
return sock;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user