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

Re: [coldsync-hackers] Variables in Coldsync.conf



[Rearranged to conform to email standards.]

On Fri, Feb 08, 2002 at 08:35:53AM -0500, Brian Johnson wrote:
> > From: Fred Gylys-Colwell
> > Sent: Friday, February 08, 2002 1:32 AM
> > To: coldsync-hackers@lusars.net
> > Subject: Re: [coldsync-hackers] Variables in Coldsync.conf
> > 
> > I think that $(HOME) gets expanded to the home directory of the user
> > running coldsync.  Are you running it as root?

	Indeed this might be the case, if you're running in daemon
mode. Rather than just taking my word as to which variables are set to
what, it'd be easier to just add a conduit like:

	#!/bin/sh
	echo "Args: $@" 1>&2
	echo "Environment:" 1>&2
	set 1>&2
	echo "200 Success"

sync with "-l mylogfile", then look at the log file.

> > It would probably take a special hack to coldsync to either read in
> > the users environment, or just set USER and HOME after it has figured
> > out who's palm is in the cradle.

	I'd kind of hoped that setuid() would set some environment
variables, but no such luck, apparently.
	It should be reasonably easy to do this, though. IMO the best
place to do this is in src/conduit.c, just after it figures out the
path to the conduit executable, and just before it calls execv(). At
that point, the relevant information is already in the global variable
'userinfo'.

> Now that gives me an idea.
> 
> As far as I can figure, right now to add a new user, you need to add an
> entry to /etc/palms to map the palm user to a local user and also make a pda
> block in coldsync.conf or .coldsyncrc.
> 
> I don't know the internal operations of Coldsync, but can the mapping to the
> local user be done within coldsync.conf?

	I'm not sure that's the best way to do things: when ColdSync
runs in daemon mode, it runs as root. It then gets a connection from
some random Palm, and needs to figure out whose Palm it is so that it
can surrender root privileges properly. The point is to run as root
for as short a time as possible. /etc/palms is intended as a minimal
file that maps PDAs to users.
	Before the setuid(), most of /etc/coldsync.conf is useless. I
think the only bits of useful information are the listen{} block and
the serial line speed (if applicable).

> Not only that, but if getting the local users home directory is difficult,
> can we just define it in the pda block and then refer to it later in the
> coldsync.conf file (in the conduit blocks)?

	ColdSync already looks up the user's home directory, because
it needs to know where to look for the ".palm" directory. So IMO the
best thing to do is to set a minimal environment just before
execv()ing the conduit.

-- 
Andrew Arensburger                      This message *does* represent the
arensb@ooblick.com                      views of ooblick.com
		     I'm not arrogant, I'm RIGHT!

-- 
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.