www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knittel, Georg" <georg.knit...@volkswagen.de>
Subject mod_jserv/3446: servlets accessing filesystem
Date Mon, 30 Nov 1998 18:40:01 GMT
The following reply was made to PR mod_jserv/3446; it has been noted by GNATS.

From: "Knittel, Georg" <georg.knittel@volkswagen.de>
To: "'apbugs@apache.org'" <apbugs@apache.org>
Cc:  Subject: mod_jserv/3446: servlets accessing filesystem
Date: Mon, 30 Nov 1998 19:32:13 +0100

 > -----Urspr=FCngliche Nachricht-----
 > Von:	Knittel, Georg=20
 > Gesendet am:	Montag, 30. November 1998 14:40
 > An:	'apbugs@apache.org'
 > Betreff:	WG: mod_jserv/3446: servlets accessing filesystem
 >=20
 >=20
 >=20
 > -----Urspr=FCngliche Nachricht-----
 > Von:	Knittel, Georg=20
 > Gesendet am:	Mittwoch, 25. November 1998 19:03
 > An:	'ed@apache.org'
 > Betreff:	AW: mod_jserv/3446: servlets accessing filesystem
 >=20
 > On HP-UX 10.20 + jdk1.1.6
 > fails inside the servlets=20
 > 1.) System.setProperties
 > 2.) File access using relativ addressing
 >=20
 > see servlet and output of first and second servlet call included=20
 >=20
 > JSERV.PROPERTIES parameter:
 >=20
 > wrapper.bin.parameters=3D"-Duser.dir=3D/var/spool/esl"
 >=20
 > SERVLET SOURCE:
 >=20
 > import java.io.*;
 > import java.util.*;
 >=20
 > import javax.servlet.*;
 > import javax.servlet.http.*;
 >=20
 >=20
 > public
 > class FSServlet extends HttpServlet {
 >     private ServletOutputStream out;
 >=20
 >     public void doGet (HttpServletRequest req, HttpServletResponse =
 res)
 >     throws ServletException, IOException
 >     {
 >     String z =3D System.getProperty("file.separator");
 >     out =3D res.getOutputStream();
 >=20
 > 	res.setContentType("text/html");
 >=20
 > 	out.println("<html>");
 > 	out.println("<head><title>File System access
 > Servlet</title></head>");
 > 	out.println("<body><pre>");
 >=20
 >     out.println("User:           " + =
 System.getProperty("user.name"));=20
 >     out.println("$HOME:          " + =
 System.getProperty("user.home"));
 >     out.println("Directory:      " + System.getProperty("user.dir")); =
 
 >     out.println("file.separator: " +
 > System.getProperty("file.separator"));=20
 >     out.println("path.separator: " +
 > System.getProperty("path.separator"));=20
 >=20
 >     File f =3D new File("/var/spool/esl/X");
 >     out.println("test <new File> name X.getPath(): " + f.getPath());=20
 >     out.println("test <new File> name X.getAbsolutePath(): " +
 > f.getAbsolutePath());=20
 >     out.println("test <new File> name X.exists(): " + f.exists());=20
 >     out.println("test <new File> name X.canWrite(): " + =
 f.canWrite());=20
 >=20
 >     out.print("test writing \"test\" to FS ... ");
 >     try {
 >        RandomAccessFile raf =3D new RandomAccessFile(f, "rw");
 >        raf.writeUTF("test");
 >        raf.close();
 >        out.println("ok");
 >     } catch (Exception e) {
 >        out.println("error");
 >     }
 >=20
 >     out.print("test reading from FS ... ");
 >     try {
 >        RandomAccessFile raf =3D new RandomAccessFile(f, "r");
 >        String           str =3D raf.readUTF();
 >        raf.close();
 >        out.println("ok read: " + str);
 >     } catch (Exception e) {
 >        out.println("error");
 >     }
 >=20
 > 	out.println("");
 >=20
 >     f =3D new File("X");
 >     out.println("User:           " + =
 System.getProperty("user.name"));=20
 >     out.println("$HOME:          " + =
 System.getProperty("user.home"));
 >     out.println("Directory:      " + System.getProperty("user.dir")); =
 
 >     out.println("file.separator: " +
 > System.getProperty("file.separator"));=20
 >     out.println("path.separator: " +
 > System.getProperty("path.separator"));=20
 >     out.println("test <new File> name X.getPath(): " + f.getPath());=20
 >     out.println("test <new File> name X.getAbsolutePath(): " +
 > f.getAbsolutePath());=20
 >     out.println("test <new File> name X.exists(): " + f.exists());=20
 >     out.println("test <new File> name X.canWrite(): " + =
 f.canWrite());=20
 >=20
 >     out.print("test writing \"test\" to FS ... ");
 >     try {
 >        RandomAccessFile raf =3D new RandomAccessFile(f, "rw");
 >        raf.writeUTF("test");
 >        raf.close();
 >        out.println("ok");
 >     } catch (Exception e) {
 >        out.println("error");
 >     }
 >=20
 >     out.print("test reading from FS ... ");
 >     try {
 >        RandomAccessFile raf =3D new RandomAccessFile(f, "r");
 >        String           str =3D raf.readUTF();
 >        raf.close();
 >        out.println("ok read: " + str);
 >     } catch (Exception e) {
 >        out.println("error");
 >     }
 >=20
 >=20
 >=20
 >=20
 >     f =3D new File("/var/spool/esl/X");
 >     out.println("User:           " + =
 System.getProperty("user.name"));=20
 >     out.println("$HOME:          " + =
 System.getProperty("user.home"));
 >     out.println("Directory:      " + System.getProperty("user.dir")); =
 
 >     out.println("file.separator: " +
 > System.getProperty("file.separator"));=20
 >     out.println("path.separator: " +
 > System.getProperty("path.separator"));=20
 >     out.println("test <new File> name X.getPath(): " + f.getPath());=20
 >     out.println("test <new File> name X.getAbsolutePath(): " +
 > f.getAbsolutePath());=20
 >     out.println("test <new File> name X.exists(): " + f.exists());=20
 >     out.println("test <new File> name X.canWrite(): " + =
 f.canWrite());=20
 >=20
 >     out.print("test writing \"test\" to FS ... ");
 >     try {
 >        RandomAccessFile raf =3D new RandomAccessFile(f, "rw");
 >        raf.writeUTF("test");
 >        raf.close();
 >        out.println("ok");
 >     } catch (Exception e) {
 >        out.println("error");
 >     }
 >=20
 >     out.print("test reading from FS ... ");
 >     try {
 >        RandomAccessFile raf =3D new RandomAccessFile(f, "r");
 >        String           str =3D raf.readUTF();
 >        raf.close();
 >        out.println("ok read: " + str);
 >     } catch (Exception e) {
 >        out.println("error");
 >     }
 >=20
 >=20
 >=20
 >     out.println("setting new environment ...");
 >     Properties env =3D new Properties();
 > //               env.put("user.name", "gkn");
 >                env.put("user.dir", "/var/spool/esl");
 > //               env.put("user.home", "/var/spool/esl");
 >=20
 >     System.setProperties(env);
 >=20
 >     f =3D new File("/var/spool/esl/X");
 >     out.println("User:           " + =
 System.getProperty("user.name"));=20
 >     out.println("$HOME:          " + =
 System.getProperty("user.home"));
 >     out.println("Directory:      " + System.getProperty("user.dir")); =
 
 >     out.println("file.separator: " +
 > System.getProperty("file.separator"));=20
 >     out.println("path.separator: " +
 > System.getProperty("path.separator"));=20
 >     out.println("test <new File> name X.getPath(): " + f.getPath());=20
 >     out.println("test <new File> name X.getAbsolutePath(): " +
 > f.getAbsolutePath());=20
 >     out.println("test <new File> name X.exists(): " + f.exists());=20
 >     out.println("test <new File> name X.canWrite(): " + =
 f.canWrite());=20
 >=20
 >=20
 >=20
 > 	out.println("</pre></body></html>");
 >     }
 >=20
 > }
 >=20
 > FIRST SERVLET CALL:
 >=20
 > User:           gkn
 > $HOME:          /home/gkn
 > Directory:      /var/spool/esl/
 > file.separator: /
 > path.separator: :
 > test  name X.getPath(): /var/spool/esl/X
 > test  name X.getAbsolutePath(): /var/spool/esl/X
 > test  name X.exists(): false
 > test  name X.canWrite(): false
 > test writing "test" to FS ... ok
 > test reading from FS ... ok read: test
 >=20
 > User:           gkn
 > $HOME:          /home/gkn
 > Directory:      /var/spool/esl/
 > file.separator: /
 > path.separator: :
 > test  name X.getPath(): X
 > test  name X.getAbsolutePath(): /var/spool/esl//X
 > test  name X.exists(): false
 > test  name X.canWrite(): false
 > test writing "test" to FS ... error
 > test reading from FS ... error
 > User:           gkn
 > $HOME:          /home/gkn
 > Directory:      /var/spool/esl/
 > file.separator: /
 > path.separator: :
 > test  name X.getPath(): /var/spool/esl/X
 > test  name X.getAbsolutePath(): /var/spool/esl/X
 > test  name X.exists(): true
 > test  name X.canWrite(): true
 > test writing "test" to FS ... ok
 > test reading from FS ... ok read: test
 > setting new environment ...
 > User:           null
 > $HOME:          null
 > Directory:      /var/spool/esl
 > file.separator: null
 > path.separator: null
 > test  name X.getPath(): /var/spool/esl/X
 > test  name X.getAbsolutePath(): /var/spool/esl/X
 > test  name X.exists(): true
 > test  name X.canWrite(): true
 >=20
 > SECOND SERVLET CALL:
 >=20
 > User:           null
 > $HOME:          null
 > Directory:      /var/spool/esl
 > file.separator: null
 > path.separator: null
 > test  name X.getPath(): /var/spool/esl/X
 > test  name X.getAbsolutePath(): /var/spool/esl/X
 > test  name X.exists(): true
 > test  name X.canWrite(): true
 > test writing "test" to FS ... ok
 > test reading from FS ... ok read: test
 >=20
 > User:           null
 > $HOME:          null
 > Directory:      /var/spool/esl
 > file.separator: null
 > path.separator: null
 > test  name X.getPath(): X
 > test  name X.getAbsolutePath(): /var/spool/esl/X
 > test  name X.exists(): false
 > test  name X.canWrite(): false
 > test writing "test" to FS ... error
 > test reading from FS ... error
 > User:           null
 > $HOME:          null
 > Directory:      /var/spool/esl
 > file.separator: null
 > path.separator: null
 > test  name X.getPath(): /var/spool/esl/X
 > test  name X.getAbsolutePath(): /var/spool/esl/X
 > test  name X.exists(): true
 > test  name X.canWrite(): true
 > test writing "test" to FS ... ok
 > test reading from FS ... ok read: test
 > setting new environment ...
 > User:           null
 > $HOME:          null
 > Directory:      /var/spool/esl
 > file.separator: null
 > path.separator: null
 > test  name X.getPath(): /var/spool/esl/X
 > test  name X.getAbsolutePath(): /var/spool/esl/X
 > test  name X.exists(): true
 > test  name X.canWrite(): true
 >=20
 > it is funny isn=B4t it ??
 >=20
 >=20
 >=20
 > -----Urspr=FCngliche Nachricht-----
 > Von:	ed@apache.org [SMTP:ed@apache.org]
 > Gesendet am:	Mittwoch, 25. November 1998 09:16
 > An:	ed@apache.org; georg.knittel@volkswagen.de; =
 jserv-bugdb@apache.org
 > Betreff:	Re: mod_jserv/3446: servlets accessing filesystem
 >=20
 > [In order for any reply to be added to the PR database, ]
 > [you need to include <apbugs@Apache.Org> in the Cc line ]
 > [and leave the subject line UNCHANGED.  This is not done]
 > [automatically because of the potential for mail loops. ]
 > [If you do not include this Cc, your reply may be ig-   ]
 > [nored unless you are responding to an explicit request ]
 > [from a developer.                                      ]
 > [Reply only with text; DO NOT SEND ATTACHMENTS!         ]
 >=20
 >=20
 > Synopsis: servlets accessing filesystem
 >=20
 > State-Changed-From-To: open-feedback
 > State-Changed-By: ed
 > State-Changed-When: Wed Nov 25 00:16:03 PST 1998
 > State-Changed-Why:
 > the JVM runs as the same uid/gid which Apache runs as --
 > this is the most likely cause of the errors which you're
 > seeing.  at present, there is no security manager w/in
 > JServ.
 >=20
 > if that's not it, please send respond to this note;
 > otherwise, I'll mark this (and PR # 3445) closed in a couple
 > of days.
 >=20
 > Ed, ed@apache.org

Mime
View raw message