Changeset 3170
- Timestamp:
- 06/12/12 19:11:46 (11 months ago)
- Location:
- alternc/trunk
- Files:
-
- 3 edited
-
bureau/class/m_bro.php (modified) (2 diffs)
-
etc/alternc/alternc-sudoers (modified) (1 diff)
-
src/fixperms.sh (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
alternc/trunk/bureau/class/m_bro.php
r3150 r3170 510 510 */ 511 511 function UploadFile($R) { 512 global $_FILES,$err ;512 global $_FILES,$err,$cuid; 513 513 $absolute=$this->convertabsolute($R,0); 514 514 if (!$absolute) { … … 522 522 } 523 523 if (@move_uploaded_file($_FILES['userfile']['tmp_name'], $absolute."/".$_FILES['userfile']['name'])) { 524 return $absolute."/".$_FILES['userfile']['name']; 524 exec("sudo /usr/lib/alternc/fixperms.sh -u ".$cuid." -f ".$absolute."/".$_FILES['userfile']['name']); 525 return $absolute."/".$_FILES['userfile']['name']; 525 526 } else { 526 527 $err->raise("bro",3); -
alternc/trunk/etc/alternc/alternc-sudoers
r3145 r3170 1 alterncpanel ALL = NOPASSWD : /usr/bin/quota, /usr/sbin/setquota 1 alterncpanel ALL = NOPASSWD : /usr/bin/quota, /usr/sbin/setquota, /usr/lib/alternc/fixperms.sh 2 2 vmail ALL = NOPASSWD : /usr/lib/dovecot/deliver -
alternc/trunk/src/fixperms.sh
r3132 r3170 32 32 query="SELECT uid,login FROM membres" 33 33 sub_dir="" 34 34 file="" 35 35 #Two optionals argument 36 36 # -l string : a specific login to fix 37 # -u interger : a specifi uid to fix 38 while getopts "l:u:d:" optname 37 # -u interger : a specific uid to fix 38 # -f interger : a specific file to fix according to a given uid 39 40 while getopts "l:u:f:d:" optname 39 41 do 40 42 case "$optname" in 41 43 "l") 42 query="SELECT uid,login FROM membres WHERE login LIKE '$OPTARG'" 44 if [[ "$OPTARG" =~ ^[a-zA-Z0-9_]+$ ]] ; then 45 query="SELECT uid,login FROM membres WHERE login LIKE '$OPTARG'" 46 else 47 echo "Bad login provided" 48 exit 49 fi 43 50 ;; 44 51 "u") 45 query="SELECT uid,login FROM membres WHERE uid LIKE '$OPTARG'" 52 if [[ "$OPTARG" =~ ^[0-9]+$ ]] ; then 53 query="SELECT uid,login FROM membres WHERE uid LIKE '$OPTARG'" 54 else 55 echo "Bad uid provided" 56 exit 57 fi 58 ;; 59 "f") 60 file="$OPTARG" 46 61 ;; 47 62 "d") … … 98 113 # Set the defaults acl on all the files 99 114 setfacl -b -k -m d:g:alterncpanel:rwx -m d:u:$GID:rw- -m d:g:$GID:rw- \ 100 - m g:alterncpanel:rwx -m u:$GID:rw- -m g:$GID:rw- \101 -R"$REP"115 -Rm g:alterncpanel:rwx -m u:$GID:rw- -m g:$GID:rw- \ 116 "$REP" 102 117 103 118 read GID LOGIN … … 105 120 } 106 121 107 mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |doone 122 fixefile(){ 123 read GID LOGIN 124 /usr/bin/setfacl -bk $file 125 echo "gid: $GID" 126 echo "file: $file" 127 chown $GID:$GID $file 128 chmod 0770 $file 129 /usr/bin/setfacl -m u:$GID:rw- -m g:$GID:rw- -m g:alterncpanel:rw- -m u:$GID:rw- -m g:$GID:rw- $file 130 echo file ownership and ACLs changed 108 131 132 } 133 134 if [[ $file != "" ]]; then 135 if [ -e $file ]; then 136 mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |fixefile 137 else 138 echo "file not found" 139 fi 140 else 141 mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |doone 142 fi
Note: See TracChangeset
for help on using the changeset viewer.
