Revision: 6990 http://ipcop.svn.sourceforge.net/ipcop/?rev=6990&view=rev Author: gespinasse Date: 2013-03-31 10:30:05 +0000 (Sun, 31 Mar 2013) Log Message: ----------- Counting lines for configured command in sudoers using visudo -ll is not reliable accross distrib. Instead check that every command we need is registered.
Modified Paths: -------------- ipcop/trunk/make.sh Modified: ipcop/trunk/make.sh =================================================================== --- ipcop/trunk/make.sh 2013-03-30 21:03:16 UTC (rev 6989) +++ ipcop/trunk/make.sh 2013-03-31 10:30:05 UTC (rev 6990) @@ -875,29 +875,25 @@ ################################################################################# echo -ne "Checking if sudo is configured ${BOLD}" SUDO_ERROR=0 - SUDO_NICE_CONFIGURED=0 - SUDO_NUMBER=11 # number of Cmnd_Alias defined, need to be adjusted in case of change # Check if the user is configured in sudoers # Ask the configuration with password send from closed standard input (0>&-) # so no password is asked for an unconfigured user if (! ${SUDO} -l -U ${CURRENT_USER} -S 0>&- &>/dev/null); then SUDO_ERROR=1 else - # Select only the lines for the current user, starting from NOPASSWD line - # Remove RunAsUsers: and Commands: lines to be able to count significatives lines - SUDO_COUNT=`${SUDO} -ll -U ${CURRENT_USER} | sed -n '/NOPASSWD/,$p' | sed -e '/RunAsUsers: root/d' -e '/Commands:/d' | wc -l` - if [ $SUDO_COUNT -lt ${SUDO_NUMBER} ]; then - echo -ne "${NORMAL} found only $SUDO_COUNT sudo command instead of mini ${SUDO_NUMBER}" - SUDO_ERROR=1 - fi - SUDO_NICE_CONFIGURED=`${SUDO} -l | grep -q '\/nice ';echo $?` + # Check every command is registered + for cmd in "$BIND" "$CHMOD" "$DU" "$LN" "$LOSETUP" "$MKDIR" "$MKNOD" "$MV" "$NICECMD" "$RM" "$UMOUNT"; do + if ( ! ${SUDO} -ll -U ${CURRENT_USER} | grep -q "${cmd}" ); then + [ $SUDO_ERROR -eq 0 ] && beautify message FAIL + beautify message FAIL "sudo fail for ${cmd}" + SUDO_ERROR=1 + fi + done fi echo -ne "${NORMAL}" - if [ ${SUDO_ERROR} -eq 0 -a ${SUDO_NICE_CONFIGURED} -eq 0 ]; then - echo -ne "${NORMAL}" + if [ ${SUDO_ERROR} -eq 0 ]; then beautify message DONE else - beautify message FAIL echo -ne "${BOLD}" echo -ne "\nAs root, use visudo to add these lines to /etc/sudoers\n" echo -ne "Make sure you don't break the lines!\n\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn