home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!know!hri.com!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!kcgl1.eng.ohio-state.edu!DAVISM
- From: DAVISM@kcgl1.eng.ohio-state.edu (Michael T. Davis)
- Newsgroups: comp.unix.ultrix
- Subject: Problem w/ mount (2) on 4.2a
- Message-ID: <1992Sep13.171916.2353@magnus.acs.ohio-state.edu>
- Date: 13 Sep 92 17:19:16 GMT
- Sender: news@magnus.acs.ohio-state.edu
- Organization: The Ohio State University
- Lines: 92
- Nntp-Posting-Host: kcgl1.eng.ohio-state.edu
-
-
- I help to maintain a system running Ultrix 4.2a -- a DECstation
- 5000/240. We would like to provide normal users a method of mounting an NFS
- filesystem. I thought we could just throw together a short C program which
- called mount(2) and install it SUID, but it doesn't seem to be working; it
- returns EFAULT, which doesn't make much sense to me. (Admittedly, I'm much
- more comfortable under VMS, so that could explain a lot. ;-) The man page
- indicates an EFAULT means that "special or name points outside the process's
- allocated address space." The code follows, with hard-coded file specifica-
- tions replaced with upper-case representations of "generic" names. Please
- send replies via E-mail.
-
- ---8<---clip here--->8---
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/fs_types.h>
-
- main ( argc, argv )
- int argc;
- char * argv [];
- {
- char * default = "DEFAULT-LOCAL-DIR",
- message [256],
- * name,
- * options = "ro",
- * special;
- int rwflag = 1,
- status,
- type = GT_NFS;
-
- /*
- * Check argument count
- */
- if ( argc < 2 || argc > 3 )
- {
- fprintf ( stderr, "%s: remote [local]\n", argv [0] );
- exit ( 1 );
- }
- /*
- * Set up remote address
- */
- special = ( char * ) argv [1];
- /*
- * Set up local address
- */
- if ( argc == 3 )
- name = ( char * ) argv [2];
- else
- name = ( char * ) default;
-
- #ifdef DEBUG
- printf ( "%s - attempting to mount %s on %s\n", argv [0], special, name );
- #endif
-
- status = mount ( special, name, rwflag, type, options ); /* EFAULT here */
- if ( status < 0 )
- {
- sprintf ( message, "%s - error mounting file system", argv [0] );
- perror ( message );
- exit ( 1 );
- }
- else
- {
- char testfile [256];
- struct stat file_status;
-
- sprintf ( testfile, "%s/TEST-FILE", name );
- #ifdef DEBUG
- printf ( "%s - checking for test file %s\n", argv [0], testfile );
- #endif
- status = stat ( testfile, & file_status );
- if ( status < 0 )
- {
- sprintf ( message, "%s - error accessing test file", argv [0] );
- perror ( message );
- umount ( name );
- exit ( 1 );
- }
- }
-
- exit ( 0 );
-
- }
- ---8<---clip here--->8---
-
- Thanks,
- Mike
- --
- Internet: davism@KCGL1.eng.ohio-state.edu |
- -or- DAVISM+@osu.edu | These Thoughts, They Be Mine
- BITNET: DAVISM+@OHSTMAIL.BITNET |
-