/*
- * $Id: afp_asp.c,v 1.16 2002-03-24 01:23:40 sibaz Exp $
+ * $Id: afp_asp.c,v 1.17 2002-08-30 19:32:40 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
#include "auth.h"
#include "fork.h"
+#ifdef FORCE_UIDGID
+#warning UIDGID
+#include "uid.h"
+#endif /* FORCE_UIDGID */
+
extern struct oforks *writtenfork;
static AFPObj *child;
reply = (*afp_switch[ func ])(obj,
asp->commands, asp->cmdlen,
asp->data, &asp->datalen);
+#ifdef FORCE_UIDGID
+ /* bring everything back to old euid, egid */
+ if (obj->force_uid)
+ restore_uidgid ( &obj->uidgid );
+#endif /* FORCE_UIDGID */
} else {
LOG(log_error, logtype_afpd, "bad function %X", func );
asp->datalen = 0;
reply = (*afp_switch[ func ])(obj,
asp->commands, asp->cmdlen,
asp->data, &asp->datalen);
+#ifdef FORCE_UIDGID
+ /* bring everything back to old euid, egid */
+ if (obj->force_uid)
+ restore_uidgid ( &obj->uidgid );
+#endif /* FORCE_UIDGID */
} else {
LOG(log_error, logtype_afpd, "(write) bad function %X", func );
asp->datalen = 0;
/*
- * $Id: afp_dsi.c,v 1.23 2002-08-22 13:19:58 jmarcus Exp $
+ * $Id: afp_dsi.c,v 1.24 2002-08-30 19:32:40 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
#include "auth.h"
#include "fork.h"
+#ifdef FORCE_UIDGID
+#warning UIDGID
+#include "uid.h"
+#endif /* FORCE_UIDGID */
+
extern struct oforks *writtenfork;
#define CHILD_DIE (1 << 0)
if (afp_switch[function]) {
dsi->datalen = DSI_DATASIZ;
child.flags |= CHILD_RUNNING;
+
err = (*afp_switch[function])(obj,
dsi->commands, dsi->cmdlen,
dsi->data, &dsi->datalen);
+#ifdef FORCE_UIDGID
+ /* bring everything back to old euid, egid */
+ if (obj->force_uid)
+ restore_uidgid ( &obj->uidgid );
+#endif /* FORCE_UIDGID */
child.flags &= ~CHILD_RUNNING;
} else {
LOG(log_error, logtype_afpd, "bad function %X", function);
err = (*afp_switch[function])(obj, dsi->commands, dsi->cmdlen,
dsi->data, &dsi->datalen);
child.flags &= ~CHILD_RUNNING;
+#ifdef FORCE_UIDGID
+ /* bring everything back to old euid, egid */
+ if (obj->force_uid)
+ restore_uidgid ( &obj->uidgid );
+#endif /* FORCE_UIDGID */
} else {
LOG(log_error, logtype_afpd, "(write) bad function %x", function);
dsi->datalen = 0;
/*
- * $Id: auth.c,v 1.27 2002-03-24 01:23:40 sibaz Exp $
+ * $Id: auth.c,v 1.28 2002-08-30 19:32:40 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
afp_switch = postauth_switch;
obj->logout = logout;
+#ifdef FORCE_UIDGID
+ obj->force_uid = 1;
+ save_uidgid ( &obj->uidgid );
+#endif
+
return( AFP_OK );
}
/*
- * $Id: directory.c,v 1.38 2002-08-29 18:57:26 didg Exp $
+ * $Id: directory.c,v 1.39 2002-08-30 19:32:40 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include "globals.h"
#include "unix.h"
-#ifdef FORCE_UIDGID
-#include "uid.h"
-#endif /* FORCE_UIDGID */
-
struct dir *curdir;
#define SENTINEL (&sentinel)
int bit = 0, isad = 1;
u_int32_t aint;
u_int16_t ashort;
-#ifdef FORCE_UIDGID
- uidgidset *uidgid;
- memset(&uidgid, 0, sizeof(uidgid));
-#endif /* FORCE_UIDGID */
memset(&ad, 0, sizeof(ad));
-#ifdef FORCE_UIDGID
- save_uidgid ( &uidgid );
- set_uidgid ( vol );
-#endif /* FORCE_UIDGID */
-
if ( ad_open( upath, ADFLAGS_HF|ADFLAGS_DIR, O_RDONLY,
DIRBITS | 0777, &ad) < 0 ) {
isad = 0;
if ( isad ) {
ad_close( &ad, ADFLAGS_HF );
}
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_BITMAP );
}
bitmap = bitmap>>1;
int change_mdate = 0;
int change_parent_mdate = 0;
int newdate = 0;
-#ifdef FORCE_UIDGID
- uidgidset *uidgid;
-
- memset(&uidgid, 0, sizeof(uidgid));
-#endif /* FORCE_UIDGID */
upath = mtoupath(vol, path);
memset(&ad, 0, sizeof(ad));
-#ifdef FORCE_UIDGID
- save_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
if (ad_open( upath, vol_noadouble(vol)|ADFLAGS_HF|ADFLAGS_DIR,
O_RDWR|O_CREAT, 0666, &ad) < 0) {
if (!vol_noadouble(vol) && (bitmap &
~((1<<DIRPBIT_ACCESS)|(1<<DIRPBIT_UID)|(1<<DIRPBIT_GID)|
(1<<DIRPBIT_MDATE)|(1<<DIRPBIT_PDINFO)))) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_ACCESS;
}
ad_close( &ad, ADFLAGS_HF );
}
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
-
if (change_parent_mdate && curdir->d_did != DIRDID_ROOT
&& gettimeofday(&tv, NULL) == 0) {
if (!movecwd(vol, curdir->d_parent)) {
char *path, *upath;
u_int32_t did;
u_int16_t vid;
-#ifdef FORCE_UIDGID
- uidgidset *uidgid;
-
- memset(&uidgid, 0, sizeof(uidgid));
-#endif /* FORCE_UIDGID */
*rbuflen = 0;
ibuf += 2;
}
}
-#ifdef FORCE_UIDGID
- save_uidgid ( &uidgid );
- set_uidgid ( vol );
-#endif /* FORCE_UIDGID */
-
if ( ad_mkdir( upath, DIRBITS | 0777 ) < 0 ) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
switch ( errno ) {
case ENOENT :
return( AFPERR_NOOBJ );
}
if (stat(upath, &st) < 0) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_MISC;
}
if ((dir = adddir( vol, curdir, path, strlen( path ), upath,
strlen(upath), &st)) == NULL) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_MISC;
}
if ( movecwd( vol, dir ) < 0 ) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_PARAM );
}
O_RDWR|O_CREAT, 0666, &ad ) < 0) {
if (vol_noadouble(vol))
goto createdir_done;
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_ACCESS );
}
memcpy( rbuf, &dir->d_did, sizeof( u_int32_t ));
*rbuflen = sizeof( u_int32_t );
setvoltime(obj, vol );
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFP_OK );
}
DIR *dp;
struct adouble ad;
u_int16_t ashort;
-#ifdef FORCE_UIDGID
- uidgidset *uidgid;
-
- memset(&uidgid, 0, sizeof(uidgid));
-#endif /* FORCE_UIDGID */
if ( curdir->d_parent == NULL ) {
return( AFPERR_ACCESS );
fdir = curdir;
-#ifdef FORCE_UIDGID
- save_uidgid ( &uidgid );
- set_uidgid ( vol );
-#endif /* FORCE_UIDGID */
-
memset(&ad, 0, sizeof(ad));
if ( ad_open( ".", ADFLAGS_HF|ADFLAGS_DIR, O_RDONLY,
DIRBITS | 0777, &ad) == 0 ) {
ad_getattr(&ad, &ashort);
ad_close( &ad, ADFLAGS_HF );
if ((ashort & htons(ATTRBIT_NODELETE))) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_OLOCK;
}
}
* note: this will not fail with dangling symlinks */
if (stat(de->d_name, &st) == 0) {
closedir(dp);
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_DIRNEMPT;
}
switch (errno) {
case EPERM:
case EACCES :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_ACCESS );
case EROFS:
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_VLOCK;
case ENOENT :
continue;
default :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_PARAM );
}
}
case ENOENT :
break;
case ENOTEMPTY :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_DIRNEMPT );
case EROFS:
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_VLOCK;
case EPERM:
case EACCES :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_ACCESS );
default :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_PARAM );
}
}
/* bail if it's not a symlink */
if ((lstat(de->d_name, &st) == 0) && !S_ISLNK(st.st_mode)) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_DIRNEMPT;
}
switch (errno) {
case EPERM:
case EACCES :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_ACCESS );
case EROFS:
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_VLOCK;
case ENOENT :
continue;
default :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_PARAM );
}
}
}
if ( movecwd( vol, curdir->d_parent ) < 0 ) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_NOOBJ );
}
if ( rmdir(mtoupath(vol, fdir->d_name)) < 0 ) {
switch ( errno ) {
case ENOENT :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_NOOBJ );
case ENOTEMPTY :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_DIRNEMPT );
case EPERM:
case EACCES :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_ACCESS );
case EROFS:
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_VLOCK;
default :
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_PARAM );
}
}
#endif /* CNID_DB */
dir_remove( vol, fdir );
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return( AFP_OK );
}
char *path, *upath;
u_int32_t did;
u_int16_t vid;
-#ifdef FORCE_UIDGID
- uidgidset *uidgid;
-
- memset(&uidgid, 0, sizeof(uidgid));
-#endif /* FORCE_UIDGID */
*rbuflen = 0;
ibuf += 2;
dir = (dir == parentdir->d_child->d_prev) ? NULL : dir->d_next;
}
-#ifdef FORCE_UIDGID
- save_uidgid ( &uidgid );
- set_uidgid ( vol );
-#endif /* FORCE_UIDGID */
-
/* we don't already have a did. add one in. */
if ((dir = adddir(vol, parentdir, path, strlen(path),
upath, strlen(upath), &st)) == NULL) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_MISC;
}
memcpy(rbuf, &dir->d_did, sizeof(dir->d_did));
*rbuflen = sizeof(dir->d_did);
-#ifdef FORCE_UIDGID
- restore_uidgid ( &uidgid );
-#endif /* FORCE_UIDGID */
return AFP_OK;
}
/*
- * $Id: file.c,v 1.52 2002-08-29 18:57:26 didg Exp $
+ * $Id: file.c,v 1.53 2002-08-30 19:32:41 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include "parse_mtab.h"
#endif /* DID_MTAB */
-#ifdef FORCE_UIDGID
-#warning UIDGID
-#include "uid.h"
-#endif /* FORCE_UIDGID */
-
/* the format for the finderinfo fields (from IM: Toolbox Essentials):
* field bytes subfield bytes
*
char *path, *upath;
int creatf, did, openf, retvalue = AFP_OK;
u_int16_t vid;
-#ifdef FORCE_UIDGID
- uidgidset *uidgid;
-#endif /* FORCE_UIDGID */
#ifdef DEBUG
LOG(log_info, logtype_afpd, "begin afp_createfile:");
openf = O_RDWR|O_CREAT|O_EXCL;
}
-#ifdef FORCE_UIDGID
-
- /* preserve current euid, egid */
- save_uidgid ( uidgid );
-
- /* perform all switching of users */
- set_uidgid ( vol );
-
-#endif /* FORCE_UIDGID */
-
if ( ad_open( upath, vol_noadouble(vol)|ADFLAGS_DF|ADFLAGS_HF,
openf, 0666, adp) < 0 ) {
switch ( errno ) {
case EEXIST :
-#ifdef FORCE_UIDGID
- /* bring everything back to old euid, egid */
- restore_uidgid ( uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_EXIST );
case EACCES :
-#ifdef FORCE_UIDGID
- /* bring everything back to old euid, egid */
- restore_uidgid ( uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_ACCESS );
case ENOENT:
/* on noadouble volumes, just creating the data fork is ok */
goto createfile_done;
/* fallthrough */
default :
-#ifdef FORCE_UIDGID
- /* bring everything back to old euid, egid */
- restore_uidgid ( uidgid );
-#endif /* FORCE_UIDGID */
return( AFPERR_PARAM );
}
}
LOG(log_info, logtype_afpd, "end afp_createfile");
#endif /* DEBUG */
-#ifdef FORCE_UIDGID
- /* bring everything back to old euid, egid */
- restore_uidgid ( uidgid );
-#endif /* FORCE_UIDGID */
-
return (retvalue);
}
int newdate = 0;
struct timeval tv;
-#ifdef FORCE_UIDGID
- uidgidset *uidgid;
-
- uidgid = malloc(sizeof(uidgidset));
-#endif /* FORCE_UIDGID */
#ifdef DEBUG
LOG(log_info, logtype_afpd, "begin setfilparams:");
adp = &ad;
}
-#ifdef FORCE_UIDGID
- save_uidgid ( uidgid );
- set_uidgid ( vol );
-#endif /* FORCE_UIDGID */
-
if (check_access(upath, OPENACC_WR ) < 0) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( uidgid );
-#endif /* FORCE_UIDGID */
return AFPERR_ACCESS;
}
O_RDWR|O_CREAT, 0666, adp) < 0) {
/* for some things, we don't need an adouble header */
if (bitmap & ~(1<<FILPBIT_MDATE)) {
-#ifdef FORCE_UIDGID
- restore_uidgid ( uidgid );
-#endif /* FORCE_UIDGID */
return vol_noadouble(vol) ? AFP_OK : AFPERR_ACCESS;
}
isad = 0;
ad_flush( adp, ADFLAGS_HF );
ad_close( adp, ADFLAGS_HF );
-#ifdef FORCE_UIDGID
- restore_uidgid ( uidgid );
-#endif /* FORCE_UIDGID */
-
}
if (change_parent_mdate && gettimeofday(&tv, NULL) == 0) {
strcpy( newname, path );
p = ctoupath( vol, curdir, newname );
-
+#ifdef FORCE_UIDGID
+ /* FIXME svid != dvid && dvid's user can't read svid */
+#endif
if (( vol = getvolbyvid( dvid )) == NULL ) {
return( AFPERR_PARAM );
}
/*
- * $Id: uid.c,v 1.12 2002-03-24 01:23:41 sibaz Exp $
+ * $Id: uid.c,v 1.13 2002-08-30 19:32:41 didg Exp $
* code: jeff@univrel.pr.uconn.edu
*
* These functions are abstracted here, so that all calls for resolving
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
+extern uid_t uuid;
+
void save_uidgid ( pair )
-uidgidset **pair;
+uidgidset *pair;
{
- /* allocate the memory */
- pair = malloc ( sizeof ( uidgidset ) );
-
- /* then assign the values */
- (*pair)->uid = geteuid ();
- (*pair)->gid = getegid ();
-} /* end function void save_uidgid ( pair ) */
+ pair->uid = geteuid ();
+ pair->gid = getegid ();
+}
void restore_uidgid ( pair )
-uidgidset **pair;
+uidgidset *pair;
{
- if ( seteuid ( (*pair)->uid ) < 0 )
- LOG(log_error, logtype_afpd, "restore_uidgid: unable to seteuid '%s': %s",
- (*pair)->uid, strerror(errno) );
- if ( setegid ( (*pair)->gid ) < 0 )
+ int uid, gid;
+
+ uid = geteuid ();
+ gid = getegid ();
+
+ if (uid == pair->uid && gid == pair->gid)
+ return;
+
+ if (seteuid(0) < 0) {
+ LOG(log_error, logtype_afpd, "set_uidgid: Could not switch back to root: %s",
+ strerror(errno));
+ }
+
+ if ( setegid ( pair->gid ) < 0 )
LOG(log_error, logtype_afpd, "restore_uidgid: unable to setegid '%s': %s",
- (*pair)->gid, strerror(errno) );
-} /* end function void restore_uidgid ( pair ) */
+ pair->gid, strerror(errno) );
+
+ if ( seteuid ( pair->uid ) < 0 )
+ LOG(log_error, logtype_afpd, "restore_uidgid: unable to seteuid '%s': %s",
+ pair->uid, strerror(errno) );
+ else
+ uuid = pair->uid; /* ugly hack for utommode */
+}
void set_uidgid ( this_volume )
const struct vol *this_volume;
int uid, gid; /* derived ones go in here */
/* check to see if we have to switch users */
- if ( uid = user_to_uid ( (this_volume)->v_forceuid ) ) {
- if ( seteuid ( uid ) < 0 )
- LOG(log_error, logtype_afpd, "set_uidgid: unable to seteuid '%s': %s",
- (this_volume)->v_forceuid, strerror(errno) );
- } /* end of checking for (this_volume)->v_forceuid */
+ uid = user_to_uid ( (this_volume)->v_forceuid);
+ gid = group_to_gid ( (this_volume)->v_forcegid);
+
+ if ((!uid || uid == geteuid()) && (!gid || gid == getegid()))
+ return;
+
+ if ( seteuid(0) < 0) {
+ LOG(log_error, logtype_afpd, "set_uidgid: Could not switch back to root: %s",
+ strerror(errno));
+ return;
+ }
/* check to see if we have to switch groups */
- if ( gid = group_to_gid ( (this_volume)->v_forcegid ) ) {
- if ( seteuid ( gid ) < 0 )
+ if ( gid ) {
+ if ( setegid ( gid ) < 0 )
LOG(log_error, logtype_afpd, "set_uidgid: unable to setegid '%s': %s",
(this_volume)->v_forcegid, strerror(errno) );
} /* end of checking for (this_volume)->v_forcegid */
+ if ( uid) {
+ if ( seteuid ( uid ) < 0 )
+ LOG(log_error, logtype_afpd, "set_uidgid: unable to seteuid '%s': %s",
+ (this_volume)->v_forceuid, strerror(errno) );
+ else
+ uuid = uid; /* ugly hack for utommode */
+
+ } /* end of checking for (this_volume)->v_forceuid */
+
} /* end function void set_uidgid ( username, group ) */
int user_to_uid ( username )
{
struct passwd *this_passwd;
- /* free memory for pointer */
- this_passwd = malloc ( sizeof ( struct passwd ) );
-
/* check for anything */
- if ( strlen ( username ) < 1 ) return 0;
+ if ( !username || strlen ( username ) < 1 ) return 0;
/* grab the /etc/passwd record relating to username */
this_passwd = getpwnam ( username );
{
struct group *this_group;
- /* free memory for pointer */
- this_group = malloc ( sizeof ( struct group ) );
-
/* check for anything */
- if ( strlen ( group ) < 1 ) return 0;
+ if ( !group || strlen ( group ) < 1 ) return 0;
/* grab the /etc/groups record relating to group */
this_group = getgrnam ( group );
/*
- * $Id: uid.h,v 1.5 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: uid.h,v 1.6 2002-08-30 19:32:41 didg Exp $
* code: jeff@univrel.pr.uconn.edu
*/
/* have to make sure struct vol is defined */
#include "volume.h"
-/* set up a structure for this */
-typedef struct uidgidset_t {
- uid_t uid;
- gid_t gid;
-} uidgidset;
-
/* functions to save and restore uid/gid pairs */
-extern void save_uidgid ( uidgidset ** );
-extern void restore_uidgid ( uidgidset ** );
+extern void save_uidgid ( uidgidset * );
+extern void restore_uidgid ( uidgidset * );
extern void set_uidgid ( const struct vol * );
/* internal functions to convert user and group names to ids */
/*
- * $Id: volume.c,v 1.32 2002-08-25 13:26:20 rlewczuk Exp $
+ * $Id: volume.c,v 1.33 2002-08-30 19:32:41 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#define VOLOPT_VETO 10 /* list of veto filespec */
#ifdef FORCE_UIDGID
+#warning UIDGID
+#include "uid.h"
+
#define VOLOPT_FORCEUID 11 /* force uid for username x */
#define VOLOPT_FORCEGID 12 /* force gid for group x */
#define VOLOPT_MAX 12
* a read-write filesystem under a read-only one. */
if ((vol->v_flags & AFPVOL_RO) ||
((utime(vol->v_path, NULL) < 0) && (errno == EROFS)))
-#ifdef WITH_CATSEARCH
- ashort |= VOLPBIT_ATTR_RO | VOLPBIT_ATTR_CATSEARCH;
-#else
ashort |= VOLPBIT_ATTR_RO;
+#ifdef WITH_CATSEARCH
+ ashort |= VOLPBIT_ATTR_CATSEARCH;
#endif
ashort = htons(ashort);
memcpy(data, &ashort, sizeof( ashort ));
volume->v_dir = volume->v_root = dir;
volume->v_flags |= AFPVOL_OPEN;
}
+#ifdef FORCE_UIDGID
+ set_uidgid ( volume );
+#endif /* FORCE_UIDGID */
if ( stat( volume->v_path, &st ) < 0 ) {
ret = AFPERR_PARAM;
return( NULL );
}
+#ifdef FORCE_UIDGID
+ set_uidgid ( vol );
+#endif /* FORCE_UIDGID */
+
return( vol );
}