From 3d70b4faeba2990bd9d6387fd2d1b8887831337d Mon Sep 17 00:00:00 2001 From: Thiago Abdo <tja14@inf.ufpr.br> Date: Tue, 19 Jan 2016 11:22:44 -0200 Subject: [PATCH] [add user] Testing done, some fixes made Signed-off-by: Thiago Abdo <tja14@inf.ufpr.br> --- hdd/adduser.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hdd/adduser.sh b/hdd/adduser.sh index eb9c4d9..1edeef5 100755 --- a/hdd/adduser.sh +++ b/hdd/adduser.sh @@ -195,38 +195,38 @@ fi #See if exist the username that we are tryng to add with non local ID checkNotLocalName=$( cat /etc/passwd | cut -d':' -f1,3 | grep -v -e ":2....$" -e ":1....$" | grep -e "^$username:" ) -if [ -z "$checkNotLocalName" ]; then +if [ -n "$checkNotLocalName" ]; then echo $0": Usuario não local com mesmo username" exit 22 fi #See if exists the group name that we are trying to add with non local GID checkNotLocalGroupName=$( cat /etc/group | grep -v -e ":2....:" -e ":1....:" | grep -e "^$groupname:" ) -if [ -z "$checkNotLocalGroupName" ]; then +if [ -n "$checkNotLocalGroupName" ]; then echo $0": Usuario não local com mesmo group name" exit 22 fi checkName=$( cat /etc/passwd | cut -d':' -f1-3 | grep -e "^$username:" ) -if [ -z "$checkName" ]; then +if [ -n "$checkName" ]; then remove_user "$checkName" echo $0": encontrei outro usuario local com o mesmo nome, devo remove-lo" fi checkID=$( cat /etc/passwd | cut -d':' -f1-3 | grep -e ":$uID$" ) -if [ -z "$checkID" ]; then +if [ -n "$checkID" ]; then remove_user "$checkID" echo $0": encontrei outro usuario local com o mesmo id, devo remove-lo" fi checkGID=$( cat /etc/group | grep -e ":$gID:" ) -if [ -z "$checkGID" ]; then +if [ -n "$checkGID" ]; then remove_group "$checkGID" echo $0": encontrei outro usuario local com o mesmo id de grupo, devo remove-lo" fi checkGName=$( cat /etc/group | grep -e "^$groupname:" ) -if [ -z "$checkGName" ]; then +if [ -n "$checkGName" ]; then remove_group "$checkGName" echo $0": encontrei outro usuario local com o mesmo nome de grupo, devo remove-lo" fi -- GitLab