106 lines
3.6 KiB
Diff
106 lines
3.6 KiB
Diff
diff --git a/tests/bash_defs.sh b/tests/bash_defs.sh
|
|
index 47aa4ec..09e06b3 100644
|
|
--- a/tests/bash_defs.sh
|
|
+++ b/tests/bash_defs.sh
|
|
@@ -187,16 +187,17 @@ function canLogIn {
|
|
# getValueFromH '/usr/include/bits/utmp.h' 'UT_NAMESIZE'
|
|
# echo $ReturnVal
|
|
function getValueFromH {
|
|
- if ! [[ -r "$1" ]]
|
|
- then
|
|
- report 'WARNING' 0 "Can't read a constant $2, header file $1 not found"
|
|
+ if ! [[ -r "$1" ]]; then
|
|
+ report 'WARNING' 1234 "Can't read a constant $2, header file $1 not found"
|
|
+ return 0
|
|
else
|
|
line="$(egrep "^#define $2..*" $1)"
|
|
- if [[ -n "$line" ]]
|
|
- then
|
|
- ReturnVal="$(echo "$line" | cut -f2)"
|
|
+ if [[ -n "$line" ]]; then
|
|
+ l_int retval=$(echo "$line" | cut -f2)
|
|
+ return $retval
|
|
else
|
|
- report 'WARNING' 0 "Can't read a constant $2 from file $1, definition of the constant not found in this file"
|
|
+ report 'WARNING' 1234 "Can't read a constant $2 from file $1, definition of the constant not found in this file"
|
|
+ return 0
|
|
fi
|
|
fi
|
|
}
|
|
diff --git a/tests/bash_defs_debug.sh b/tests/bash_defs_debug.sh
|
|
index a0d548d..d3beeff 100644
|
|
--- a/tests/bash_defs_debug.sh
|
|
+++ b/tests/bash_defs_debug.sh
|
|
@@ -352,18 +352,19 @@ function canLogIn {
|
|
# getValueFromH '/usr/include/bits/utmp.h' 'UT_NAMESIZE'
|
|
# echo $ReturnVal
|
|
function getValueFromH {
|
|
- if ! [[ -r "$1" ]]
|
|
- then
|
|
- report 'WARNING' 0 "Can't read a constant $2, header file $1 not found"
|
|
- else
|
|
- line="$(egrep "^#define $2..*" $1)"
|
|
- if [[ -n "$line" ]]
|
|
- then
|
|
- ReturnVal="$(echo "$line" | cut -f2)"
|
|
- else
|
|
- report 'WARNING' 0 "Can't read a constant $2 from file $1, definition of the constant not found in this file"
|
|
- fi
|
|
- fi
|
|
+ if ! [[ -r "$1" ]]; then
|
|
+ report 'WARNING' 1234 "Can't read a constant $2, header file $1 not found"
|
|
+ return 0
|
|
+ else
|
|
+ line="$(egrep "^#define $2..*" $1)"
|
|
+ if [[ -n "$line" ]]; then
|
|
+ l_int retval=$(echo "$line" | cut -f2)
|
|
+ return $retval
|
|
+ else
|
|
+ report 'WARNING' 1234 "Can't read a constant $2 from file $1, definition of the constant not found in this file"
|
|
+ return 0
|
|
+ fi
|
|
+ fi
|
|
}
|
|
|
|
# function isValidName
|
|
diff --git a/tests/group.sh b/tests/group.sh
|
|
index ef24886..4c43d94 100755
|
|
--- a/tests/group.sh
|
|
+++ b/tests/group.sh
|
|
@@ -106,7 +106,7 @@ fi
|
|
|
|
##### too long groupname #####
|
|
getValueFromH '/usr/include/bits/utmp.h' 'UT_NAMESIZE'
|
|
- MaxLength=$ReturnVal
|
|
+ MaxLength=$?
|
|
length="`echo \"$groupname\" | wc -m`"
|
|
if [ $length -gt $MaxLength ]
|
|
then
|
|
diff --git a/tests/passwd.sh b/tests/passwd.sh
|
|
index 536697f..c1bf10d 100755
|
|
--- a/tests/passwd.sh
|
|
+++ b/tests/passwd.sh
|
|
@@ -123,8 +123,8 @@ check_file_perm $group_shadow 400 root:root 1 $E_BAD_PERMISSIONS "Shadow group
|
|
|
|
##### too long username #####
|
|
getValueFromH '/usr/include/bits/utmp.h' 'UT_NAMESIZE'
|
|
- MaxLength=$ReturnVal
|
|
- length="`echo \"$username\" | wc -m`"
|
|
+ MaxLength=$?
|
|
+ length=$(echo "$username" | wc -m)
|
|
if [ $length -gt $MaxLength ]
|
|
then
|
|
report 'ERROR' $E_LONG_USERNAME "\$passwd: Line \$i: User \$username has too long username."
|
|
diff --git a/tests/shadow.sh b/tests/shadow.sh
|
|
index 778f39e..48773e2 100755
|
|
--- a/tests/shadow.sh
|
|
+++ b/tests/shadow.sh
|
|
@@ -104,7 +104,7 @@ check_file_perm $group_shadow 400 root:root 1 $E_BAD_PERMISSIONS_SHADOW "Group
|
|
|
|
##### too long username #####
|
|
getValueFromH '/usr/include/bits/utmp.h' 'UT_NAMESIZE'
|
|
- MaxLength=$ReturnVal
|
|
+ MaxLength=$?
|
|
length=`echo "$username" | wc -m`
|
|
if [ $length -gt $MaxLength ]
|
|
then
|