asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group) { long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); /* avoid REGPARM breakage on x86: */ asmlinkage_protect(3, ret, filename, user, group); return ret; }
/**************************************************************************** ** prepare to dump a core file - carefully! **************************************************************************** */ static BOOL dump_core(void) { char *p; pstring dname; pstrcpy( dname, debugf ); if ((p=strrchr(dname,'/'))) *p=0; pstrcat( dname, "/corefiles" ); mkdir( dname, 0700 ); sys_chown( dname, getuid(), getgid() ); chmod( dname, 0700 ); if ( chdir(dname) ) return( False ); umask( ~(0700) ); #ifdef HAVE_GETRLIMIT #ifdef RLIMIT_CORE { struct rlimit rlp; getrlimit( RLIMIT_CORE, &rlp ); rlp.rlim_cur = MAX( 4*1024*1024, rlp.rlim_cur ); setrlimit( RLIMIT_CORE, &rlp ); getrlimit( RLIMIT_CORE, &rlp ); DEBUG( 3, ( "Core limits now %d %d\n", (int)rlp.rlim_cur, (int)rlp.rlim_max ) ); } #endif #endif DEBUG(0,("Dumping core in %s\n",dname)); abort(); return( True ); } /* dump_core */
int vfswrap_chown(vfs_handle_struct *handle, connection_struct *conn, const char *path, uid_t uid, gid_t gid) { int result; START_PROFILE(syscall_chown); result = sys_chown(path, uid, gid); END_PROFILE(syscall_chown); return result; }
void dump_core_setup(const char *progname) { pstring logbase; char * end; if (lp_logfile() && *lp_logfile()) { snprintf(logbase, sizeof(logbase), "%s", lp_logfile()); if ((end = strrchr_m(logbase, '/'))) { *end = '\0'; } } else { /* We will end up here is the log file is given on the command * line by the -l option but the "log file" option is not set * in smb.conf. */ snprintf(logbase, sizeof(logbase), "%s", dyn_LOGFILEBASE); } SMB_ASSERT(progname != NULL); snprintf(corepath, sizeof(corepath), "%s/cores", logbase); mkdir(corepath,0700); snprintf(corepath, sizeof(corepath), "%s/cores/%s", logbase, progname); mkdir(corepath,0700); sys_chown(corepath,getuid(),getgid()); chmod(corepath,0700); #ifdef HAVE_GETRLIMIT #ifdef RLIMIT_CORE { struct rlimit rlp; getrlimit(RLIMIT_CORE, &rlp); rlp.rlim_cur = MAX(16*1024*1024,rlp.rlim_cur); setrlimit(RLIMIT_CORE, &rlp); getrlimit(RLIMIT_CORE, &rlp); DEBUG(3,("Maximum core file size limits now %d(soft) %d(hard)\n", (int)rlp.rlim_cur,(int)rlp.rlim_max)); } #endif #endif #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) /* On Linux we lose the ability to dump core when we change our user * ID. We know how to dump core safely, so let's make sure we have our * dumpable flag set. */ prctl(PR_SET_DUMPABLE, 1); #endif /* FIXME: if we have a core-plus-pid facility, configurably set * this up here. */ }
asmlinkage long sys_chown16(const char * filename, old_uid_t user, old_gid_t group) { return sys_chown(filename, low2highuid(user), low2highgid(group)); }
asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group) { return sys_chown(filename, low2highuid(user), low2highgid(group)); }
int dos_chown(char *fname, uid_t uid, gid_t gid) { return(sys_chown(dos_to_unix(fname,False),uid,gid)); }