HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: faxrcvd script does not work


On Thu, 6 Jan 2000, Ertan Kucukoglu wrote:

> Nico Kadel-Garcia wrote:
> > > I mkdir /var/spool/fax/ftp directory and wanted to copy only received
> > > faxes into that directory, but can not run this cp command (although I
> > > copied 'cp' tp /var/spool/fax/bin/.
> > 
> > Hmm. Haven't tried this kind of stunt myself: I simply make symbolic
> > links from /var/spool/fax/recvq to wherever I want the faxes to be
> > visible as a user, not as part of the faxrcvd process.
> > 
> I want to explain the whole process. I want to put faxes in sepereta
> directories based on date. (for example all 1/1/2000 dated faxes fill go
> to somewhere/2000/01/01/*)
> For that I write a small program with c. That program takes directories
> as parameters and checkes for their existence. If it can not find the
> directory, it tries to create it. If it does this for all directories
> returns 0 if fails on some routine it returns a negative value.

This would be reasonable, *EXCEPT* that if there is a chroot
going on. Chroot effectively makes all references to filename relative
to "/", relative to the new chrooted directory.

> And, lets come to path settings.
> About path settings I look at /var/spool/fax/etc/setup.cache file. In
> that file /bin, /sbin, /usr/sbin. I guess these are my search path
> (correct me if I am wrong).

They are your search path: unfortunately, they are also affected
by running in a chrooted environment. This is not a problem when
running most *other* programs, such as faxsetup or faxaddmodem,
that are run by root from a normal shell.

> If I am correct; date, cp, mv commands should run in script. If they do
> not... I return to beginning I do not undertand the working style of
> this script.

I do sympathize with your difficulty! It is possible, although potentially
dangerous, to have your C program do a "chroot" itself to correctly
create the directories you want.

> And, although date, cp, mv commands are in path (according to me) I
> copied a copy of them to /var/spool/fax/bin/ dir. I tried to run
> commands like bin/cp and bin/date.

This may not work: those are typically dynamically linked, and unless
you also bring the libc and other libraries to $SPOOLDIR/lib, you
can have more problems.

> After some parameter and usage changes I get error numbers from faxrcvd
> like 01000, 0400, 0774.
> After a little search I find that I can run only cat command.

Right. cat is not dynamically linked.

> > Looks like the chroot problem. Let me make a quick and dirty suggestion:
> > teach faxrcvd to do a
> > 
> >         mkdir -p destination directory
> > 
> > And see exactly where that destination is winding up. Then realize
> > that you are dealing with files *THERE*, and let faxrcvd set the file
> > permissions or anything else there appropriately. This is a quick and
> > dirty, and while not necessarily secure might save you some time.
> > 
> Security is not a problem. I will reach these files with anonymous ftp
> connection. I will try this tomorrow and let you know.

Note: anonymous ftp *ALSO* does a chroot. This is why I tend to use a
web server access to my received faxes, with its more configurable
access and control of this.

			Nico Kadel-Garcia
			Senior Engineer, CIRL 
			Mass. Eye and Ear Infirmary

Version: 2.6.2


Project hosted by iFAX Solutions