GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: chroot patch for openssh-3.5p1
Operating System - HP-UX
1847587
Members
3529
Online
110265
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2003 08:57 AM
03-19-2003 08:57 AM
chroot patch for openssh-3.5p1
I am configuring an ftp server using Openssh and I need to have the chroot functionality. I downloaded the patch openssh-3.5p1-chroot-patch.tmaletic.txt (from another posting in the forums), but when I run the command:
patch session.c openssh-3.5p1-chroot-patch.tmaletic.txt
I get the following results:
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.rej 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
Need much appreciated help on this.
Thanks
--Youlette
patch session.c openssh-3.5p1-chroot-patch.tmaletic.txt
I get the following results:
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.rej 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
Need much appreciated help on this.
Thanks
--Youlette
If at first you don't succeed, change the rules!
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2003 09:50 AM
03-19-2003 09:50 AM
Re: chroot patch for openssh-3.5p1
HI,
You should use gnu patch tool and not the patch tool distributed with HP-UX, On my side it solved many patching !!!
You can downlaod it at
http://hpux.connect.org.uk
I'm not sure it will solve, but may be ?
hth
Benoit
You should use gnu patch tool and not the patch tool distributed with HP-UX, On my side it solved many patching !!!
You can downlaod it at
http://hpux.connect.org.uk
I'm not sure it will solve, but may be ?
hth
Benoit
Une application mal pansée aboutit à une usine à gaze (GHG)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2003 09:16 AM
03-20-2003 09:16 AM
Re: chroot patch for openssh-3.5p1
Hi Benoit,
Thanks for your reply. I installed the gnu patch tool, but I get the same result.
/usr/local/bin/patch -p1 session.c osshChroot-3.5.diff.txt
patching file session.c
Hunk #1 succeeded at 67 with fuzz 2 (offset 9 lines).
Hunk #2 FAILED at 1207.
Hunk #3 FAILED at 1249.
2 out of 3 hunks FAILED -- saving rejects to file session.c.rej
Thanks for your reply. I installed the gnu patch tool, but I get the same result.
/usr/local/bin/patch -p1 session.c osshChroot-3.5.diff.txt
patching file session.c
Hunk #1 succeeded at 67 with fuzz 2 (offset 9 lines).
Hunk #2 FAILED at 1207.
Hunk #3 FAILED at 1249.
2 out of 3 hunks FAILED -- saving rejects to file session.c.rej
If at first you don't succeed, change the rules!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2003 06:05 AM
03-24-2003 06:05 AM
Re: chroot patch for openssh-3.5p1
Are you running this against the 3.5p1 version of the OpenSSH sources? (If you build without the patch, and do a "ssh -V", what output do you get? What is the output of "grep RCSID session.c"?) -Tim
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP