Hi, Attached is a patch that adds support for svnserver in rssh.
Cheers, Jelmer -- Jelmer Vernooij <[EMAIL PROTECTED]> - http://jelmer.vernstok.nl/
diff -ru rssh-2.2.3/configure.ac /home/rhonwyn/jelmer/rssh-2.2.3/configure.ac
--- rssh-2.2.3/configure.ac 2004-12-29 20:32:21.000000000 +0100
+++ /home/rhonwyn/jelmer/rssh-2.2.3/configure.ac 2005-03-29
16:36:47.000000000 +0200
@@ -168,6 +168,23 @@
AC_MSG_WARN([specified rsync binary does not exist])
fi
+# Check for svnserve binary
+
+AC_ARG_WITH(svnserve,
+[ --with-svnserve specify path to svnserve binary],
+[svnserve_path="$withval"], [svnserve_path=""])
+
+AC_PATH_PROG(svnserve_path, svnserve, [], [])
+if test -z "$svnserve_path"; then
+ AC_MSG_WARN([can't find svnserve - using /usr/bin/svnserve. Use
--with-svnserve to override])
+ svnserve_path=/usr/bin/svnserve
+fi
+
+if ! test -x "$svnserve_path"; then
+ AC_MSG_WARN([specified svnserve binary does not exist])
+fi
+
+
# disable static configuration
@@ -199,6 +216,7 @@
AC_SUBST(cvs_path)
AC_SUBST(rdist_path)
AC_SUBST(rsync_path)
+AC_SUBST(svnserve_path)
AC_SUBST(prefix)
AC_SUBST(sysconfdir)
AC_SUBST(libexecdir)
diff -ru rssh-2.2.3/main.c.in /home/rhonwyn/jelmer/rssh-2.2.3/main.c.in
--- rssh-2.2.3/main.c.in 2004-12-21 07:07:45.000000000 +0100
+++ /home/rhonwyn/jelmer/rssh-2.2.3/main.c.in 2005-03-29 16:54:12.000000000
+0200
@@ -218,6 +218,8 @@
argvec[2] = "4";
else if ( !(strcmp(*cmd, PATH_RSYNC)) )
argvec[2] = "5";
+ else if ( !(strcmp(*cmd, PATH_SVNSERVE)) )
+ argvec[2] = "6";
else {
log_set_priority(LOG_ERR);
log_msg("fatal error identifying the correct command "
diff -ru rssh-2.2.3/pathnames.h.in
/home/rhonwyn/jelmer/rssh-2.2.3/pathnames.h.in
--- rssh-2.2.3/pathnames.h.in 2003-08-08 23:49:28.000000000 +0200
+++ /home/rhonwyn/jelmer/rssh-2.2.3/pathnames.h.in 2005-03-29
16:37:03.000000000 +0200
@@ -34,6 +34,7 @@
#define PATH_SFTP_SERVER "@sftp_path@"
#define PATH_SCP "@scp_path@"
#define PATH_CVS "@cvs_path@"
+#define PATH_SVNSERVE "@svnserve_path@"
#define PATH_RDIST "@rdist_path@"
#define PATH_RSYNC "@rsync_path@"
diff -ru rssh-2.2.3/rssh.1 /home/rhonwyn/jelmer/rssh-2.2.3/rssh.1
--- rssh-2.2.3/rssh.1 2004-12-30 21:27:42.000000000 +0100
+++ /home/rhonwyn/jelmer/rssh-2.2.3/rssh.1 2005-03-30 21:45:20.507265467
+0200
@@ -14,7 +14,7 @@
allowing a user whose shell is configured to
.B rssh
to use one or more of the command(s) \fIscp\fP(1) or \fIsftp\fP(1)
-\fIcvs\fP(1), \fIrdist\fP(1), and \fIrsync\fP(1), and
+\fIcvs\fP(1), \fIrdist\fP(1), \fIrsync\fP(1), and \fIsvnserve\fP(8) and
.B only
those commands. It is intended primarily to work with OpenSSH (see
http://www.openssh.com), but may work with other implementations.
diff -ru rssh-2.2.3/rssh.conf.5.in
/home/rhonwyn/jelmer/rssh-2.2.3/rssh.conf.5.in
--- rssh-2.2.3/rssh.conf.5.in 2003-08-08 21:39:42.000000000 +0200
+++ /home/rhonwyn/jelmer/rssh-2.2.3/rssh.conf.5.in 2005-03-30
21:46:23.465992829 +0200
@@ -50,6 +50,11 @@
Tells the shell that rsync is allowed.
.RE
.P
+.B allowsvnserve
+.RS
+Tells the shell that svnserve is allowed.
+.RE
+.P
.B umask
.RS
Sets the umask value for file creations in the scp/sftp session. This is
@@ -114,8 +119,8 @@
.B access bits
.RS
Five binary digits, which indicate whether the user is allowed to use rsync,
-rdist, cvs, sftp, and scp, in that order. One means the command is allowed,
-zero means it is not.
+rdist, cvs, sftp, scp, and svnserve, in that order. One means the command
+is allowed, zero means it is not.
.RE
.B path
.RS
diff -ru rssh-2.2.3/rssh.h /home/rhonwyn/jelmer/rssh-2.2.3/rssh.h
--- rssh-2.2.3/rssh.h 2003-08-08 21:02:02.000000000 +0200
+++ /home/rhonwyn/jelmer/rssh-2.2.3/rssh.h 2005-03-29 16:30:39.000000000
+0200
@@ -46,6 +46,7 @@
#define RSSH_ALLOW_CVS (1 << 2)
#define RSSH_ALLOW_RDIST (1 << 3)
#define RSSH_ALLOW_RSYNC (1 << 4)
-#define RSSH_USE_CHROOT (1 << 5)
+#define RSSH_ALLOW_SVNSERVE (1 << 5)
+#define RSSH_USE_CHROOT (1 << 6)
#endif /* _rssh_h */
Only in /home/rhonwyn/jelmer/rssh-2.2.3/: rssh_chroot_helper
diff -ru rssh-2.2.3/rssh_chroot_helper.c
/home/rhonwyn/jelmer/rssh-2.2.3/rssh_chroot_helper.c
--- rssh-2.2.3/rssh_chroot_helper.c 2004-04-02 06:08:04.000000000 +0200
+++ /home/rhonwyn/jelmer/rssh-2.2.3/rssh_chroot_helper.c 2005-03-29
16:56:04.000000000 +0200
@@ -162,6 +162,9 @@
case 5:
argv[3] = PATH_RSYNC;
break;
+ case 6:
+ argv[3] = PATH_SVNSERVE;
+ break;
default:
log_msg("invalid command specified");
exit(2);
Only in /home/rhonwyn/jelmer/rssh-2.2.3/: rssh_chroot_helper.o
diff -ru rssh-2.2.3/rsshconf.c /home/rhonwyn/jelmer/rssh-2.2.3/rsshconf.c
--- rssh-2.2.3/rsshconf.c 2004-10-23 06:41:35.000000000 +0200
+++ /home/rhonwyn/jelmer/rssh-2.2.3/rsshconf.c 2005-03-29 16:28:21.000000000
+0200
@@ -71,6 +71,7 @@
"allowcvs",
"allowrdist",
"allowrsync",
+ "allowsvnserve",
"chrootpath",
"logfacility",
"umask",
@@ -93,6 +94,9 @@
int process_allow_scp( ShellOptions_t *opts, const char *line,
const int lineno );
+int process_allow_svnserve( ShellOptions_t *opts, const char *line,
+ const int lineno );
+
int process_allow_sftp( ShellOptions_t *opts, const char *line,
const int lineno );
@@ -213,21 +217,26 @@
return FALSE;
return TRUE;
case 6:
+ /* allow svnserve */
+ if ( !(process_allow_svnserve(opts, line + pos, lineno) ) )
+ return FALSE;
+ return TRUE;
+ case 7:
/* default chroot path */
if ( !(process_chroot_path(opts, line + pos, lineno) ) )
return FALSE;
return TRUE;
- case 7:
+ case 8:
/* syslog log facility */
if ( !(process_log_facility(opts, line + pos, lineno) ) )
return FALSE;
return TRUE;
- case 8:
+ case 9:
/* set the user's umask */
if ( !(process_umask(opts, line + pos, lineno) ) )
return FALSE;
return TRUE;
- case 9:
+ case 10:
/* user */
if ( !(process_user(opts, line + pos, lineno) ) )
return FALSE;
@@ -529,6 +538,30 @@
return TRUE;
}
+/*
+ * process_allow_svnserve() - make sure there are no tokens after the keyword,
+ * other than a possible comment. If there are
+ * additional tokens other than comments, there is a
+ * syntax error, and FALSE is returned. Otherwise, the
+ * line is ok, so opts are set to allow svnserve, and
TRUE
+ * is returned.
+ */
+int process_allow_svnserve( ShellOptions_t *opts,
+ const char *line,
+ const int lineno )
+{
+ int pos;
+
+ if ( !(pos = eat_comment(line)) ){
+ log_msg("line %d: syntax error parsing config file", lineno);
+ return FALSE;
+ }
+ log_set_priority(LOG_INFO);
+ log_msg("allowing svnserve to all users");
+ opts->shell_flags |= RSSH_ALLOW_SVNSERVE;
+ return TRUE;
+}
+
int process_chroot_path( ShellOptions_t *opts,
const char *line,
@@ -814,6 +847,7 @@
bool allow_cvs;
bool allow_rdist;
bool allow_rsync;
+ bool allow_svnserve;
/* make space for user options */
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){
@@ -875,7 +909,7 @@
return FALSE;
}
if ( !validate_access(axs, &allow_sftp, &allow_scp, &allow_cvs,
- &allow_rdist, &allow_rsync) ){
+ &allow_rdist, &allow_rsync, &allow_svnserve) ){
log_set_priority(LOG_ERR);
log_msg("syntax error parsing access bits, line %d", lineno);
return FALSE;
@@ -941,6 +975,11 @@
log_msg("allowing rsync to user %s", user);
opts->shell_flags |= RSSH_ALLOW_RSYNC;
}
+ if ( allow_svnserve ){
+ log_msg("allowing svnserve to user %s", user);
+ opts->shell_flags |= RSSH_ALLOW_SVNSERVE;
+ }
+
if ( path ){
log_msg("chrooting %s to %s", user, path);
opts->shell_flags |= RSSH_USE_CHROOT;
diff -ru rssh-2.2.3/util.c /home/rhonwyn/jelmer/rssh-2.2.3/util.c
--- rssh-2.2.3/util.c 2004-12-29 21:28:55.000000000 +0100
+++ /home/rhonwyn/jelmer/rssh-2.2.3/util.c 2005-03-29 16:44:36.000000000
+0200
@@ -79,6 +79,7 @@
if ( flags & RSSH_ALLOW_SFTP ) size += 5;
if ( flags & RSSH_ALLOW_CVS ) size += 4;
if ( flags & RSSH_ALLOW_RDIST ) size += 6;
+ if ( flags & RSSH_ALLOW_SVNSERVE ) size += 10;
if ( flags & RSSH_ALLOW_RSYNC ) size += 5; /* last one, no space */
/* create msg indicating what is allowed */
@@ -101,6 +102,8 @@
strncat(cmd, "rdist ", size);
if ( flags & RSSH_ALLOW_RSYNC )
strncat(cmd, "rsync", size);
+ if ( flags & RSSH_ALLOW_SVNSERVE )
+ strncat(cmd, "svnserve", size);
}
/* print error message to user and log attempt */
@@ -238,6 +241,9 @@
return PATH_RSYNC;
}
+ if ( check_command(cl, opts, PATH_SVNSERVE, RSSH_ALLOW_SVNSERVE) )
+ return PATH_SVNSERVE;
+
return NULL;
}
@@ -302,11 +308,11 @@
* same name, and returns FALSE if the bits are not valid
*/
int validate_access( const char *temp, bool *allow_sftp, bool *allow_scp,
- bool *allow_cvs, bool *allow_rdist, bool *allow_rsync )
+ bool *allow_cvs, bool *allow_rdist, bool *allow_rsync,
bool *allow_svnserve )
{
int i;
-#define NUM_ACCESS_BITS 5
+#define NUM_ACCESS_BITS 6
if ( strlen(temp) != NUM_ACCESS_BITS ) return FALSE;
/* make sure the bits are valid */
@@ -318,6 +324,7 @@
*allow_cvs = temp[2] - '0';
*allow_sftp = temp[3] - '0';
*allow_scp = temp[4] - '0';
+ *allow_svnserve = temp[5] - '0';
return TRUE;
}
diff -ru rssh-2.2.3/util.h /home/rhonwyn/jelmer/rssh-2.2.3/util.h
--- rssh-2.2.3/util.h 2004-12-29 20:23:39.000000000 +0100
+++ /home/rhonwyn/jelmer/rssh-2.2.3/util.h 2005-03-29 16:30:05.000000000
+0200
@@ -37,7 +37,7 @@
char *extract_root( char *root, char *path );
int validate_umask( const char *temp, int *mask );
int validate_access( const char *temp, bool *allow_sftp, bool *allow_scp,
- bool *allow_cvs, bool *allow_rdist, bool *allow_rsync );
+ bool *allow_cvs, bool *allow_rdist, bool *allow_rsync,
bool *allow_svnserve);
bool opt_exist(char *cl, char opt);
#endif /* _util_h */
signature.asc
Description: Digital signature

