1833461 Members
3275 Online
110052 Solutions
New Discussion

Installing Openssh-3.5p1

 
Youlette Etienne_2
Regular Advisor

Installing Openssh-3.5p1

I am configuring an ftp server and am attempting to incorporate the chroot functionality. I downloaded the patch openssh-3.5p1-chroot-patch.tmaletic.txt (found from another forum response), however when I execute the command:

patch session.c openssh-3.5p1-chroot-patch.tmaletic.txt

I get the following message:
Hmm... Looks like a new-style context diff to me...
The text leading up to this was:
--------------------------
|*** session.c.dist Wed Sep 25 20:38:50 2002
|--- session.c Tue Jan 14 14:55:45 2003
--------------------------
Patching file session.c using Plan A...
Hunk #1 failed at 1195.
Hunk #2 failed at 1247.
2 out of 2 hunks failed--saving rejects to session.c.rej
done

session.c.rj contains the following:
***************
*** 1195,1200 ****
void
do_setusercontext(struct passwd *pw)
{
#ifdef HAVE_CYGWIN
if (is_winnt) {
#else /* HAVE_CYGWIN */
--- 1195,1202 ----
void
do_setusercontext(struct passwd *pw)
{
+ char *user_dir;
+ char *new_root;
#ifdef HAVE_CYGWIN
if (is_winnt) {
#else /* HAVE_CYGWIN */
***************
*** 1245,1250 ****
# ifdef _AIX
aix_usrinfo(pw);
# endif /* _AIX */
/* Permanently switch to the desired uid. */
permanently_set_uid(pw);
#endif
--- 1247,1268 ----
# ifdef _AIX
aix_usrinfo(pw);
# endif /* _AIX */
+ user_dir = xstrdup(pw->pw_dir);
+ new_root = user_dir + 1;
+ while((new_root = strchr(new_root, '.')) != NULL) {
+ new_root--;
+ if(strncmp(new_root, "/./", 3) == 0) {
+ *new_root = '\0';
+ new_root += 2;
+ debug("Attempting to chroot to %s", user_dir);
+ if(chroot(user_dir) != 0)
+ fatal("Couldn't chroot to user directory %s: %s", user_dir, strerror(errno));
+ pw->pw_dir = new_root;
+ options.print_lastlog = NULL;
+ break;
+ }
+ new_root += 2;
+ }
/* Permanently switch to the desired uid. */
permanently_set_uid(pw);
#endif

Much needed help in resolving this problem, is greatly appreciated.

Thanks

Youlette
If at first you don't succeed, change the rules!