Subversion Repositories public

Compare Revisions

Ignore whitespace Rev 76 → Rev 77

/incron/trunk/incron.conf.5
1,4 → 1,4
.TH "incron.conf" "5" "0.5.3" "Lukas Jelinek" "incron documentation"
.TH "incron.conf" "5" "0.5.4" "Lukas Jelinek" "incron documentation"
.SH "NAME"
/etc/incron.conf \- main config file for inotify cron (incron)
.SH "DESCRIPTION"
/incron/trunk/incrontab.5
1,4 → 1,4
.TH "incrontab" "5" "0.5.3" "Lukas Jelinek" "incron documentation"
.TH "incrontab" "5" "0.5.4" "Lukas Jelinek" "incron documentation"
.SH "NAME"
incrontab \- tables for driving inotify cron (incron)
.SH "DESCRIPTION"
/incron/trunk/CHANGELOG
1,3 → 1,9
0.5.4 2007-02-11
* bug related to persisting environment fixed (#0000149)
* incrond(8) man page updated to explain how the environment is treated
* buggy example configuration file fixed
 
 
0.5.3 2007-02-08
* bug related to ignoring new tables fixed (#0000142)
* explicit typecasting in execlp() call (#0000145)
/incron/trunk/incrond.8
1,9 → 1,9
.TH "incrond" "8" "0.5.3" "Lukas Jelinek" "incron documentation"
.TH "incrond" "8" "0.5.4" "Lukas Jelinek" "incron documentation"
.SH "NAME"
incrond \- inotify cron (incron) daemon
 
.SH "SYNOPSIS"
\fBincrond\fR [ <options> ]
\fBincrond\fR [ \-f \fIfile\fR ] [ \-n | \-k ]
.SH "DESCRIPTION"
The inotify cron daemon (\fIincrond\fR) is a daemon which monitors filesystem events and executes commands defined in system and user tables. It's use is generally similar to \fIcron\fR(8).
 
24,7 → 24,9
 
\fB\-k\fR (or \fB\-\-kill\fR) option terminates a running instance of \fBincrond\fR.
 
\fB\-f <FILE>\fR (or \fB\-\-config=<FILE>\fR) option specifies another location for the configuration file (/etc/incron.conf is used by default).
\fB\-f <FILE>\fR (or \fB\-\-config=<FILE>\fR) option specifies another location for the configuration file (/etc/incron.conf is used by default).
 
\fBEnvironment variables:\fR For system tables, the default (the same as for incrond itself) environment variable set is used. The same applies to root's table. For non\-root user tables, the whole environment is cleared and then only these variables are set: LOGNAME, USER, USERNAME, SHELL, HOME and PATH. The variables (except PATH) take values from the user database (e.g. /etc/passwd). The PATH variable is set to /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin.
.SH "SEE ALSO"
incrontab(1), incrontab(5), incron.conf(5)
.SH "BUGS"
/incron/trunk/incron.conf.example
38,7 → 38,7
# Default: /etc/incron.deny
#
# Example:
# allowed_users = /etc/incron/deny
# denied_users = /etc/incron/deny
 
 
# Parameter: lockfile_dir
/incron/trunk/usertable.cpp
31,7 → 31,10
#define DONT_FOLLOW(mask) (false)
#endif // IN_DONT_FOLLOW
 
// this is not enough, but...
#define DEFAULT_PATH "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin"
 
 
PROC_MAP UserTable::s_procMap;
 
extern volatile bool g_fFinish;
384,15 → 387,7
}
else {
// for user table
struct passwd* pwd = getpwnam(m_user.c_str());
if ( pwd == NULL // user not found
|| setgid(pwd->pw_gid) != 0 // setting GID failed
|| setuid(pwd->pw_uid) != 0 // setting UID failed
|| execvp(argv[0], argv) != 0) // exec failed
{
syslog(LOG_ERR, "cannot exec process: %s", strerror(errno));
_exit(1);
}
RunAsUser(argv);
}
}
else if (pid > 0) {
529,5 → 524,36
return false; // no access right found
}
 
void UserTable::RunAsUser(char* const* argv) const
{
struct passwd* pwd = getpwnam(m_user.c_str());
if ( pwd == NULL // user not found
|| setgid(pwd->pw_gid) != 0 // setting GID failed
|| setuid(pwd->pw_uid) != 0) // setting UID failed
{
goto failed;
}
if (pwd->pw_uid != 0) {
if (clearenv() != 0)
goto failed;
if ( setenv("LOGNAME", pwd->pw_name, 1) != 0
|| setenv("USER", pwd->pw_name, 1) != 0
|| setenv("USERNAME", pwd->pw_name, 1) != 0
|| setenv("HOME", pwd->pw_dir, 1) != 0
|| setenv("SHELL", pwd->pw_shell, 1) != 0
|| setenv("PATH", DEFAULT_PATH, 1) != 0)
{
goto failed;
}
}
execvp(argv[0], argv); // this may return only on failure
failed:
syslog(LOG_ERR, "cannot exec process: %s", strerror(errno));
_exit(1);
}
 
 
/incron/trunk/usertable.h
223,6 → 223,12
return IncronTab::CheckUser(user);
}
/// Runs a program as the table's user.
/**
* \attention Don't call from the main process (before forking)!
*/
void RunAsUser(char* const* argv) const;
private:
Inotify m_in; ///< inotify object
EventDispatcher* m_pEd; ///< event dispatcher
/incron/trunk/incrontab.1
1,4 → 1,4
.TH "incrontab" "1" "0.5.3" "Lukas Jelinek" "incron documentation"
.TH "incrontab" "1" "0.5.4" "Lukas Jelinek" "incron documentation"
.SH "NAME"
incrontab \- table manipulator for inotify cron (incron)
.SH "SYNOPSIS"