Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* cdrom mount for users
@ 1996-01-31  5:00 Christophe MATHIEU
  1996-02-05  5:00 ` Hugues Talbot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Christophe MATHIEU @ 1996-01-31  5:00 UTC (permalink / raw)


My question is simple (very simple?).
How to autorise a user (not root) to mount a cdrom on osf 3.0 ?

please mail and post !
thanks




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cdrom mount for users
  1996-02-05  5:00 ` Hugues Talbot
@ 1996-02-05  5:00   ` Alain Cedelle
  0 siblings, 0 replies; 5+ messages in thread
From: Alain Cedelle @ 1996-02-05  5:00 UTC (permalink / raw)



In article <yea68dmgutk.fsf@fire.syd.dms.CSIRO.AU>, 
talbot@fire.syd.dms.CSIRO.AU (Hugues Talbot) writes:
|>	Here's a little utility that will mount a cd-rom on a Digital
|>200-4/233 under Dunix 3.2c. 

 doesn't work for me:

# cd-mount
cdfs_mount: Unknown descriptor type
File system name invalid
#
# mount -r /dev/rz4c /cdrom    (no prob. here)
#

 I'm on OSF 3.2  . 

a.c.
 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cdrom mount for users
  1996-01-31  5:00 cdrom mount for users Christophe MATHIEU
@ 1996-02-05  5:00 ` Hugues Talbot
  1996-02-05  5:00 ` Hugues Talbot
  1996-02-07  5:00 ` Simon Wright
  2 siblings, 0 replies; 5+ messages in thread
From: Hugues Talbot @ 1996-02-05  5:00 UTC (permalink / raw)



	Hi everyone,

	Here's a little utility that will mount a cd-rom on a Digital
200-4/233 under Dunix 3.2c. I'm not sure about other versions.
	It mounts the cd-rom on /cdrom, assuming your
cd-rom drive in on the SCSI chain at address 4 (device /dev/rz4c).
If your configuration does not match this, then you'll have a bit
of editing to do. Should be straightforward.

	Compile that thing with cc -o cd-mount cd-mount.c, then chmod
s+u root cd-mount, finally place it in a public place (maybe
/usr/local/bin). This will then execute as root. Since the only thing
it does is take that device and mount it in the expected place,
it should be safe enough. I suppose you could do the same thing with a
simple shell script. However, you have to be a bit more cautious with
shell scripts suid to root since they can more easily become security
problems.

	You'll want the cd-umount utility as well. It's listed
after that. suid u+s root cd-umount as well.

	If unhappy about something let me know.

-------------------------------------------------------
cd-mount.c


/*
 * this mounts a ISO-9660 CD-ROM on a DEC UNIX 200 E
 * workstation
 *
 * by Hugues Talbot     10 Jan 1996
 *
 */
#include <errno.h>
#include <sys/mount.h>
#include <cdfs/cdfsmount.h>
#include <stdio.h>


main()
{
    int res;
    struct cdfs_args cd_struct;

    /* fill the structure */
    cd_struct.fspec = "/dev/rz4c";
    cd_struct.exflags = 0;
    cd_struct.exroot = 0;
    cd_struct.flags = M_NOVERSION | M_RRIP;
    cd_struct.version = 0;
    cd_struct.default_uid = 0;
    cd_struct.default_gid = 0;  /* root all the time by default... */
    cd_struct.default_fmode = 0664;
    cd_struct.default_dmode = 0755;
    cd_struct.map_uid_ct = 0;
    cd_struct.map_uid = NULL;
    cd_struct.map_gid_ct = 0;
    cd_struct.map_gid = NULL;

    /* mount read-only and no suid of any kind */
    res = mount(MOUNT_CDFS, "/cdrom",
                M_RDONLY | M_NOSUID,
                &cd_struct);

    if (res != 0) {
        switch (errno) {
          case EPERM:
            fprintf(stderr, "Insufficient permissions\n");
            break;
          case ENAMETOOLONG:
            fprintf(stderr, "Path name too long\n");
            break;
          case ELOOP:
            fprintf(stderr, "Recursive path\n");
            break;
          case EMFILE:
            fprintf(stderr, "Mount table is full\n");
            break;
          case ENOENT:
            fprintf(stderr, "Mount point invalid\n");
            break;
          case ENOTDIR:
            fprintf(stderr, "Mount point not a directory\n");
            break;
          case EINVAL:
            fprintf(stderr, "File system name invalid\n");
            break;
          case EBUSY:
            fprintf(stderr, "Mount point is busy\n");
            break;
          case EDIRTY:
            fprintf(stderr, "Filesystem is dirty\n");
            break;
          case EFAULT:
            fprintf(stderr, "Mount point pointer invalid\n");
            break;
          case ENODEV:
            fprintf(stderr, "A component of fspec does not exist\n");
            break;
          case ENOTBLK:
            fprintf(stderr, "Not a block device\n");
            break;
          case ENXIO:
            fprintf(stderr, "Block number out of range. No driver"
                    "exists for hardware\n");
            break;
          case ENOMEM:
            fprintf(stderr, "Not enough memory\n");
            break;
          case EIO:
            fprintf(stderr, "I/O error. Ouch, not very informative...\n");
            break;
          default:
            fprintf(stderr, "Unknown error #%d\n", errno);
            break;          
        }
    }
    
    return res;
}


-----------------------------------------------------
cd-umount.c

/*
 *
 * This unmount a CD-ROM from a DEC UNIX 200 workstation
 *
 * by Hugues Talbot     10 Jan 1996
 *
 */

#include <errno.h>
#include <sys/mount.h>
#include <stdio.h>


main()
{
    int res;

    res = umount("/mnt", 0);

    if (res != 0) {
        switch (errno) {
          case EPERM:
            fprintf(stderr, "Insufficient privilege\n");
            break;
          case ENOTDIR:
            fprintf(stderr, "Given path is not a directory\n");
            break;
          case ENAMETOOLONG:
            fprintf(stderr, "Given path is too long\n");
            break;
          case ELOOP:
            fprintf(stderr, "Infinite recursion in path\n");
            break;
          case EINVAL:
            fprintf(stderr, "CD-ROM was not mounted\n");
            break;
          case EBUSY:
            fprintf(stderr, "Device is busy\n");
            break;
          case EIO:
            fprintf(stderr, "I/O error. Bad...\n");
            break;
          case EFAULT:
            fprintf(stderr, "Path pointer out of address space\n");
            break;
          default:
            fprintf(stderr, "Unknown error #%d\n", errno);
            break;
        }
    }   
    
    return res;
}

---------------------------------------------------------






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cdrom mount for users
  1996-01-31  5:00 cdrom mount for users Christophe MATHIEU
  1996-02-05  5:00 ` Hugues Talbot
@ 1996-02-05  5:00 ` Hugues Talbot
  1996-02-05  5:00   ` Alain Cedelle
  1996-02-07  5:00 ` Simon Wright
  2 siblings, 1 reply; 5+ messages in thread
From: Hugues Talbot @ 1996-02-05  5:00 UTC (permalink / raw)




Hi everyone,

	Here's a little utility that will mount a cd-rom on a Digital
200-4/233 under Dunix 3.2c. I'm not sure about other versions.
	It mounts the cd-rom on /cdrom, assuming your
cd-rom drive in on the SCSI chain at address 4 (device /dev/rz4c).
If your configuration does not match this, then you'll have a bit
of editing to do. Should be straightforward.

	Compile that thing with cc -o cd-mount cd-mount.c, then chmod
s+u root cd-mount, finally place it in a public place (maybe
/usr/local/bin). This will then execute as root. Since the only thing
it does is take that device and mount it in the expected place,
it should be safe enough. I suppose you could do the same thing with a
simple shell script. However, you have to be a bit more cautious with
shell scripts suid to root since they can more easily become security
problems.

	You'll want the cd-umount utility as well. It's listed
after that. suid u+s root cd-umount as well.

	If unhappy about something let me know.

-------------------------------------------------------
cd-mount.c


/*
 * this mounts a ISO-9660 CD-ROM on a DEC UNIX 200 E
 * workstation
 *
 * by Hugues Talbot     10 Jan 1996
 *
 */
#include <errno.h>
#include <sys/mount.h>
#include <cdfs/cdfsmount.h>
#include <stdio.h>


main()
{
    int res;
    struct cdfs_args cd_struct;

    /* fill the structure */
    cd_struct.fspec = "/dev/rz4c";
    cd_struct.exflags = 0;
    cd_struct.exroot = 0;
    cd_struct.flags = M_NOVERSION | M_RRIP;
    cd_struct.version = 0;
    cd_struct.default_uid = 0;
    cd_struct.default_gid = 0;  /* root all the time by default... */
    cd_struct.default_fmode = 0664;
    cd_struct.default_dmode = 0755;
    cd_struct.map_uid_ct = 0;
    cd_struct.map_uid = NULL;
    cd_struct.map_gid_ct = 0;
    cd_struct.map_gid = NULL;

    /* mount read-only and no suid of any kind */
    res = mount(MOUNT_CDFS, "/cdrom",
                M_RDONLY | M_NOSUID,
                &cd_struct);

    if (res != 0) {
        switch (errno) {
          case EPERM:
            fprintf(stderr, "Insufficient permissions\n");
            break;
          case ENAMETOOLONG:
            fprintf(stderr, "Path name too long\n");
            break;
          case ELOOP:
            fprintf(stderr, "Recursive path\n");
            break;
          case EMFILE:
            fprintf(stderr, "Mount table is full\n");
            break;
          case ENOENT:
            fprintf(stderr, "Mount point invalid\n");
            break;
          case ENOTDIR:
            fprintf(stderr, "Mount point not a directory\n");
            break;
          case EINVAL:
            fprintf(stderr, "File system name invalid\n");
            break;
          case EBUSY:
            fprintf(stderr, "Mount point is busy\n");
            break;
          case EDIRTY:
            fprintf(stderr, "Filesystem is dirty\n");
            break;
          case EFAULT:
            fprintf(stderr, "Mount point pointer invalid\n");
            break;
          case ENODEV:
            fprintf(stderr, "A component of fspec does not exist\n");
            break;
          case ENOTBLK:
            fprintf(stderr, "Not a block device\n");
            break;
          case ENXIO:
            fprintf(stderr, "Block number out of range. No driver"
                    "exists for hardware\n");
            break;
          case ENOMEM:
            fprintf(stderr, "Not enough memory\n");
            break;
          case EIO:
            fprintf(stderr, "I/O error. Ouch, not very informative...\n");
            break;
          default:
            fprintf(stderr, "Unknown error #%d\n", errno);
            break;          
        }
    }
    
    return res;
}


-----------------------------------------------------
cd-umount.c

/*
 *
 * This unmount a CD-ROM from a DEC UNIX 200 workstation
 *
 * by Hugues Talbot     10 Jan 1996
 *
 */

#include <errno.h>
#include <sys/mount.h>
#include <stdio.h>


main()
{
    int res;

    res = umount("/mnt", 0);

    if (res != 0) {
        switch (errno) {
          case EPERM:
            fprintf(stderr, "Insufficient privilege\n");
            break;
          case ENOTDIR:
            fprintf(stderr, "Given path is not a directory\n");
            break;
          case ENAMETOOLONG:
            fprintf(stderr, "Given path is too long\n");
            break;
          case ELOOP:
            fprintf(stderr, "Infinite recursion in path\n");
            break;
          case EINVAL:
            fprintf(stderr, "CD-ROM was not mounted\n");
            break;
          case EBUSY:
            fprintf(stderr, "Device is busy\n");
            break;
          case EIO:
            fprintf(stderr, "I/O error. Bad...\n");
            break;
          case EFAULT:
            fprintf(stderr, "Path pointer out of address space\n");
            break;
          default:
            fprintf(stderr, "Unknown error #%d\n", errno);
            break;
        }
    }   
    
    return res;
}

---------------------------------------------------------






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cdrom mount for users
  1996-01-31  5:00 cdrom mount for users Christophe MATHIEU
  1996-02-05  5:00 ` Hugues Talbot
  1996-02-05  5:00 ` Hugues Talbot
@ 1996-02-07  5:00 ` Simon Wright
  2 siblings, 0 replies; 5+ messages in thread
From: Simon Wright @ 1996-02-07  5:00 UTC (permalink / raw)


I think you should look at the perror() function - save you a lot of
typing in those case statements -

Cheers

-- 
Simon Wright                                          (G-net) +842-1778
Ferranti Naval Systems                        (voice) +44(0)1705-701778
GEC-Marconi S3I Combat Systems Division         (fax) +44(0)1705-701800



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1996-02-07  5:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-01-31  5:00 cdrom mount for users Christophe MATHIEU
1996-02-05  5:00 ` Hugues Talbot
1996-02-05  5:00 ` Hugues Talbot
1996-02-05  5:00   ` Alain Cedelle
1996-02-07  5:00 ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox