Re: [PARPORT] Using C to program printer port

From: Robert Heller (heller@deepsoft.com)
Date: Mon Jan 27 2003 - 21:43:37 EST

  • Next message: Simon: "Re: [PARPORT] Using C to program printer port"

      Ingo Flaschberger <if@sil.at>,
      In a message on Tue, 28 Jan 2003 01:59:15 +0100 (MET), wrote :

    IF> Hi
    IF>
    IF> > I have successfully taken code from your examples and written a program that
    IF> > makes the output lines of the printer port go hi/low as desired and toggle a
    IF> > relay.
    IF> >
    IF> > Now, I have two more problems:
    IF> >
    IF> > Gora - what you said is correct; I have to be root to get your program to
    IF> > work. Otherwise, I get a "segmentation fault" error. How can I get around
    IF> > this?
    IF> >
    IF> > I need to have Apache (which runs as wwwrun) execute this code in my cgi-bin
    IF> > directory. I'm setting this up so when someone clicks on a bar
    IF> > on the webpage, it pulls in a relay.
    IF>
    IF> suid-bit? -> http://www.linuxgeek.net/index.pl/suid

    Better: chown/chmod of /dev/lp?

    The suid-bit is seriously *dangerious*. All it takes is a silly
    buffer-overrun bug and a seriously clever cracker and your system is
    trashed.

    Changing the ownership and/or protection of a file in /dev is far
    safer. The *kernel* does not really care what the UID/GID of the
    process doing I/O, so long as the process has *permission* to do the
    I/O. This is handled by matching the process's effective UID/GID to
    the ownership and protection (mode) of the I/O dev file in question.
    This is in fact what the owner and mode bits are there for.

    IF>
    IF> cya,
    IF> Ingo
    IF>
    IF>
    IF> -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    IF> -- with the single word "unsubscribe" in the body of the message. --
    IF>
    IF>

                                         \/
    Robert Heller ||InterNet: heller@cs.umass.edu
    http://vis-www.cs.umass.edu/~heller || heller@deepsoft.com
    http://www.deepsoft.com /\FidoNet: 1:321/153

                                                         

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Mon Jan 27 2003 - 21:26:36 EST