LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   openbsd 5.1 apply patch for mod_userdir (https://www.linuxquestions.org/questions/%2Absd-17/openbsd-5-1-apply-patch-for-mod_userdir-4175427504/)

sasser 09-16-2012 09:52 AM

openbsd 5.1 apply patch for mod_userdir
 
Hello

The userdir support was accidentally left out of httpd in OpenBSD 5.1 release. I need that support so I try to apply the fix patch (userdir.patch).
Seaching the Internet I found something called userdir.patch on OpenBSD website:
http://ftp.openbsd.org/pub/OpenBSD/p.../userdir.patch
I did read the FAQ about installing patches but I still couldn't figure out how to do it :(

In userdir.patch there is a section describing the steps to do it:
Code:

Apply by doing
        cd /usr/src/usr.sbin/httpd/src
        patch -p0 < userdir.patch

And then rebuild httpd by doing
        cd /usr/src/usr.sbin/httpd
        make clean && make && make install

The problem is that I don't have that path. My /usr/src directory is empty.
Why? What can I do?
I'm new to OpenBSD and I haven't applied any patch yet, maybe I'm doing something wrong?

I spent a hole week to figure out why the userdir doesn't work reading tens of tutorials and forums, just to find that the OpenBSD team forgot to add it and now, I found the solution but I can't use it. It's very frustraing.

ocicat 09-16-2012 10:19 AM

Quote:

Originally Posted by sasser (Post 4781608)
The problem is that I don't have that path. My /usr/src directory is empty.

Correct. By default, the installation of OpenBSD does not include installing source code. This is discussed in Section 5.3.3 of the FAQ. Assuming you installed 5.1-release, go to a mirror site & download the files:
  • src.tar.gz
  • sys.tar.gz
...& ensure you get these files for 5.1-release. Further instructions on installation can be found in the appropriate portion of Section 5.3.3.

sasser 09-16-2012 01:27 PM

Thanks for your quick answer ocicat.

I followed your guidance and downloaded those two files from
http://ftp5.eu.openbsd.org/ftp/pub/OpenBSD/5.1/
and extract them to /usr/src

Then I downloaded the userdir.patch
http://ftp5.eu.openbsd.org/ftp/pub/O.../userdir.patch

Next, move the userdir.patch to /usr/src/usr.sbin/httpd/src, and:
Code:

# cd /usr/src/usr.sbin/httpd/src
# patch -p0 < userdir.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Note: this is the third version of this patch.
|
|Apply by doing
|      cd /usr/src/usr.sbin/httpd/src
|      patch -p0 < userdir.patch
|
|And then rebuild httpd by doing
|      cd /usr/src/usr.sbin/httpd
|      make clean && make && make install
|
|Index: Configuration
|===================================================================
|RCS file: /cvs/src/usr.sbin/httpd/src/Configuration,v
|retrieving revision 1.2
|retrieving revision 1.3
|diff -u -r1.2 -r1.3
|--- Configuration      1998/10/01 17:29:04    1.2
|+++ Configuration      1998/11/15 00:14:32    1.3
--------------------------
Patching file Configuration using Plan A...
Hunk #1 succeeded at 335 with fuzz 2 (offset 47 lines).
done
# cd /usr/src/usr.sbin/httpd/
# make clean && make && make install
make: don't know how to make clean. Stop in /usr/src/usr.sbin/httpd.
#

What's wrong?

ocicat 09-16-2012 07:29 PM

Quote:

Originally Posted by sasser (Post 4781711)
Code:

# make clean && make && make install
make: don't know how to make clean. Stop in /usr/src/usr.sbin/httpd.
#

What's wrong?

I have one observation & one guess.

First, since you have just downloaded & installed the source code, executing the clean target is not especially important in this singular case, however, this doesn't answer the question about what is amiss.

My guess is that either the path or permissions are wrong, & I lean towards the latter. The instructions in Section 5.3.3 preface each command with a '#' hash symbol which is shorthand for indicating that these commands are to be executed either as root or via sudo(8). I suspect these commands were not executed as root, & this is the reason why you are unable to build.

sasser 09-17-2012 12:47 PM

Quote:

Originally Posted by ocicat (Post 4781913)
I suspect these commands were not executed as root, & this is the reason why you are unable to build.

I was root when running those commands (logged in as a different user, the use su command to become root), the code block from my previous post was captured from putty terminal, you can see the distinctive sign for root: "#"
The patch seems to be applied OK since the exit message is:
Patching file Configuration using Plan A...
Hunk #1 succeeded at 335 with fuzz 2 (offset 47 lines).
done


I did install a fresh copy of OpenBSD 5.1 on another machine, defined no other user, logged in as root and apply the patch, I get the same answer. Something else should be wrong, I don't think the permissions.

sasser 09-17-2012 01:30 PM

Looking in the directory where I supposed to run make there was no Makefile, just Makefile.bsd-wrapper and Makefile.tmpl
I did:
Code:

# make -f Makefile.bsd-wrapper
and something happened.. I don't know what, but the result was a new file appeared: Makefile

Then I followed the steps to do from userdir.patch:
Code:

# cd /usr/src/usr.sbin/httpd
# make clean && make && make install

The rebuild started and finished with the message:
Code:

+--------------------------------------------------------+
| You now have successfully built and installed the      |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the        |
| (initially created or preserved) configuration files  |
|                                                        |
|  /var/www/conf/httpd.conf
|                                                        |
| and then you should be able to immediately fire up    |
| Apache the first time by running:                      |
|                                                        |
|  /usr/sbin/apachectl start
|                                                        |
| Or when you want to run it with SSL enabled use:      |
|                                                        |
|  /usr/sbin/apachectl startssl
|                                                        |
| Thanks for using Apache.      The Apache Group        |
|                                http://www.apache.org/  |
+--------------------------------------------------------+

I've opened the /var/www/conf/httpd.conf file but seems unchanged :( nothing new for userdir. Searched my system for mod_userdir.so.. nothing :(

Started Apache:
Code:

# apachectl start
/usr/sbin/apachectl start: httpd started

Go to my user page: localhost/~paul
And the same answer.. couldn't find it.
Looking in the error_log, the Apache still look in htdocs for that directory instead in /home/paul/public_html:
Code:

[Mon Sep 17 20:02:37 2012] [error] [client 127.0.0.1] File does not exist: /htdocs/~paul
[Mon Sep 17 20:21:59 2012] [error] [client 192.168.2.20] File does not exist: /htdocs/~paul/index.html

It doesn't work either I try from server itself issuing localhost/~paul or from an external machine.
There is a file called index.html inside that directory.
The permissions to public_html are 755 and for index.html are 644 so the user www should be able to traverse the directory structure and get that file.
The UserDir configuration in httpd.conf is:
Code:

429 UserDir "public_html"
 430 UserDir disabled
 431 UserDir enabled paul
....
451 <Directory "/home/*/public_html">
 452    AllowOverride FileInfo AuthConfig Limit
 453    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
 454    <Limit GET POST OPTIONS PROPFIND>
 455        Order allow,deny
 456        Allow from all
 457    </Limit>
 458    <Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
 459        Order deny,allow
 460        Deny from all
 461    </Limit>
 462 </Directory>

What I wrong? What can I done more? Is it correctly what I've done? Even mentioning that at least one part from the configuration is correct is a great help. I'm new to OpenBSD and I'm unsure about many things about it :(
Thanks for reading..


All times are GMT -5. The time now is 10:03 PM.