@@ -607,9 +607,9 @@ static void add_group(const char *user, const char *group)
607
607
return ; /* already group member */
608
608
609
609
if (systemf ("adduser %s %s" , user , group ))
610
- SECURITY ("Failed giving user %s UNIX %s permissions." , user , group );
610
+ AUDIT ("Failed giving user \"%s\" UNIX %s permissions." , user , group );
611
611
else
612
- SECURITY ("User %s added to UNIX %s group." , user , group );
612
+ AUDIT ("User \"%s\" added to UNIX \"%s\" group." , user , group );
613
613
}
614
614
615
615
static void del_group (const char * user , const char * group )
@@ -620,9 +620,9 @@ static void del_group(const char *user, const char *group)
620
620
return ; /* not member of group */
621
621
622
622
if (systemf ("delgroup %s %s" , user , group ))
623
- SECURITY ("Failed removing user %s from UNIX %s group." , user , group );
623
+ AUDIT ("Failed removing user \"%s\" from UNIX \"%s\" group." , user , group );
624
624
else
625
- SECURITY ("User %s removed from UNIX %s group." , user , group );
625
+ AUDIT ("User \"%s\" removed from UNIX \"%s\" group." , user , group );
626
626
}
627
627
628
628
/* Users with a valid shell are also allowed CLI access */
@@ -786,7 +786,7 @@ static int sys_call_adduser(sr_session_ctx_t *sess, char *name, uid_t uid, gid_t
786
786
char * * args ;
787
787
int err ;
788
788
789
- DEBUG ("Adding new user %s , cleaning up any stale group." , name );
789
+ DEBUG ("Adding new user \"%s\" , cleaning up any stale group." , name );
790
790
systemf ("delgroup %s 2>/dev/null" , name );
791
791
792
792
/* reusing existing uid:gid from $HOME */
@@ -840,15 +840,15 @@ static int sys_add_user(sr_session_ctx_t *sess, char *name)
840
840
/* Verify IDs aren't already used, like BusyBox adduser */
841
841
if (getpwuid (st .st_uid ) || getgrgid (st .st_uid ) || getgrgid (st .st_gid )) {
842
842
/* Exists but owned by someone else. */
843
- SECURITY ("Failed mapping user %s to /home/%s, uid:gid (%d:%d) already exists." ,
843
+ AUDIT ("Failed mapping user \"%s\" to /home/%s, uid:gid (%d:%d) already exists." ,
844
844
name , name , st .st_uid , st .st_gid );
845
845
err = sys_call_adduser (sess , name , 0 , 0 );
846
846
} else {
847
- SECURITY ("Reusing uid:gid %d:%d and /home/%s for new user %s " ,
847
+ AUDIT ("Reusing uid:gid %d:%d and /home/%s for new user \"%s\" " ,
848
848
st .st_uid , st .st_gid , name , name );
849
849
err = sys_call_adduser (sess , name , st .st_uid , st .st_gid );
850
850
if (err ) {
851
- SECURITY ("Failed reusing uid:gid from /home/%s, retrying create user ..." , name );
851
+ AUDIT ("Failed reusing uid:gid from /home/%s, retrying create user ..." , name );
852
852
err = sys_call_adduser (sess , name , 0 , 0 );
853
853
} else
854
854
reused = true;
@@ -857,11 +857,11 @@ static int sys_add_user(sr_session_ctx_t *sess, char *name)
857
857
err = sys_call_adduser (sess , name , 0 , 0 );
858
858
859
859
if (err ) {
860
- SECURITY ("Failed creating new user \"%s\"" , name );
860
+ AUDIT ("Failed creating new user \"%s\"" , name );
861
861
return SR_ERR_SYS ;
862
862
}
863
863
864
- SECURITY ("User \"%s\" created%s." , name , reused ? ", mapped to existing home directory" : "" );
864
+ AUDIT ("User \"%s\" created%s." , name , reused ? ", mapped to existing home directory" : "" );
865
865
866
866
/*
867
867
* OpenSSH in Infix has been set up to use /var/run/sshd/%s.keys
@@ -930,7 +930,7 @@ static int set_shell(const char *user, const char *shell)
930
930
931
931
if (!strcmp (pw -> pw_name , user )) {
932
932
if (strcmp (pw -> pw_shell , shell ))
933
- NOTE ("Updating login shell for user %s to %s" , user , shell );
933
+ AUDIT ("Updating login shell for user \"%s\" to %s" , user , shell );
934
934
935
935
upw = * pw ;
936
936
upw .pw_shell = (char * )shell ;
@@ -953,7 +953,7 @@ static int set_shell(const char *user, const char *shell)
953
953
if (fp )
954
954
fclose (fp );
955
955
endpwent ();
956
- ERRNO ("Failed setting user %s shell %s" , user , shell );
956
+ ERRNO ("Failed setting user \"%s\" shell %s" , user , shell );
957
957
958
958
return -1 ;
959
959
}
@@ -971,7 +971,7 @@ static int set_password(const char *user, const char *hash, bool lock)
971
971
972
972
fp = fopen (_PATH_SHADOW "+" , "w" );
973
973
if (!fp ) {
974
- ERRNO ("Failed opening %s+ for %s " , _PATH_SHADOW , user );
974
+ ERRNO ("Failed opening %s+ for user \"%s\" " , _PATH_SHADOW , user );
975
975
goto fail ;
976
976
}
977
977
fd = fileno (fp );
@@ -1016,7 +1016,7 @@ static int set_password(const char *user, const char *hash, bool lock)
1016
1016
endspent ();
1017
1017
ulckpwdf ();
1018
1018
exit :
1019
- SECURITY ("Failed setting password for %s " , user );
1019
+ AUDIT ("Failed setting password for user \"%s\" " , user );
1020
1020
1021
1021
return -1 ;
1022
1022
}
@@ -1045,7 +1045,7 @@ static const char *is_valid_hash(struct confd *confd, const char *user, const ch
1045
1045
1046
1046
pwd = json_object_get (confd -> root , "factory-password-hash" );
1047
1047
if (!json_is_string (pwd )) {
1048
- EMERG ("Cannot find factory-default password hash for user %s !" , user );
1048
+ EMERG ("Cannot find factory-default password hash for user \"%s\" !" , user );
1049
1049
return NULL ;
1050
1050
}
1051
1051
@@ -1072,7 +1072,7 @@ static sr_error_t handle_sr_passwd_update(sr_session_ctx_t *, struct confd *conf
1072
1072
assert (change -> new );
1073
1073
1074
1074
if (change -> new -> type != SR_STRING_T ) {
1075
- SECURITY ("Internal error, expected user %s password to be string type." , user );
1075
+ AUDIT ("Internal error, expected user \"%s\" password to be string type." , user );
1076
1076
err = SR_ERR_INTERNAL ;
1077
1077
break ;
1078
1078
}
@@ -1090,17 +1090,17 @@ static sr_error_t handle_sr_passwd_update(sr_session_ctx_t *, struct confd *conf
1090
1090
if (set_password (user , hash , lock ))
1091
1091
err = SR_ERR_SYS ;
1092
1092
else if (lock )
1093
- NOTE ("User account %s locked." , user );
1093
+ NOTE ("User account \"%s\" locked." , user );
1094
1094
else if (!strcmp (hash , "*" ))
1095
- NOTE ("Password login disabled for user %s " , user );
1095
+ NOTE ("Password login disabled for user \"%s\" " , user );
1096
1096
else
1097
- SECURITY ("Password updated for user %s " , user );
1097
+ AUDIT ("Password updated for user \"%s\" " , user );
1098
1098
break ;
1099
1099
case SR_OP_DELETED :
1100
1100
if (set_password (user , "*" , false))
1101
1101
err = SR_ERR_SYS ;
1102
1102
else
1103
- NOTE ("Password login disabled for user %s " , user );
1103
+ NOTE ("Password login disabled for user \"%s\" " , user );
1104
1104
break ;
1105
1105
case SR_OP_MOVED :
1106
1106
break ;
@@ -1125,10 +1125,10 @@ static sr_error_t handle_sr_shell_update(sr_session_ctx_t *sess, struct confd *c
1125
1125
1126
1126
shell = sys_find_usable_shell (sess , (char * )user , is_admin_user (sess , user ));
1127
1127
if (set_shell (user , shell )) {
1128
- SECURITY ("Failed updating shell to %s for user %s " , shell , user );
1128
+ AUDIT ("Failed updating shell to %s for user \"%s\" " , shell , user );
1129
1129
err = SR_ERR_SYS ;
1130
1130
} else {
1131
- SECURITY ("Login shell updated for user %s " , user );
1131
+ AUDIT ("Login shell updated for user \"%s\" " , user );
1132
1132
err = SR_ERR_OK ;
1133
1133
}
1134
1134
free (shell );
@@ -1148,7 +1148,7 @@ static sr_error_t check_sr_user_update(sr_session_ctx_t *, struct confd *, struc
1148
1148
1149
1149
name = sr_xpath_key_value (val -> xpath , "user" , "name" , & state );
1150
1150
if (!is_valid_username (name )) {
1151
- SECURITY ("Invalid username \"%s\"" , name );
1151
+ AUDIT ("Invalid username \"%s\"" , name );
1152
1152
return SR_ERR_VALIDATION_FAILED ;
1153
1153
}
1154
1154
NOTE ("Username \"%s\" is valid" , name );
@@ -1232,7 +1232,7 @@ static sr_error_t generate_auth_keys(sr_session_ctx_t *session, const char *xpat
1232
1232
1233
1233
fp = fopenf ("w" , "/var/run/sshd/%s.keys" , username );
1234
1234
if (!fp ) {
1235
- ERROR ("failed opening %s authorized_keys file: %s" , username , strerror (errno ));
1235
+ ERROR ("failed opening user \"%s\" authorized_keys file: %s" , username , strerror (errno ));
1236
1236
continue ;
1237
1237
}
1238
1238
@@ -1361,7 +1361,7 @@ static sr_error_t change_auth_done(struct confd *confd, sr_session_ctx_t *sessio
1361
1361
1362
1362
err = generate_auth_keys (session , XPATH_AUTH_ "/user//." );
1363
1363
if (err ) {
1364
- SECURITY ("failed saving authorized-key data." );
1364
+ AUDIT ("failed saving authorized-key data." );
1365
1365
goto cleanup ;
1366
1366
}
1367
1367
@@ -1432,11 +1432,11 @@ static int change_nacm(sr_session_ctx_t *session, uint32_t sub_id, const char *m
1432
1432
for (size_t i = 0 ; i < user_count ; i ++ ) {
1433
1433
const char * user = users [i ].data .string_val ;
1434
1434
bool is_admin = is_admin_user (session , user );
1435
- char * shell ;
1435
+ const char * shell ;
1436
1436
1437
1437
shell = sys_find_usable_shell (session , (char * )user , is_admin );
1438
1438
if (set_shell (user , shell ))
1439
- SECURITY ("Failed adjusting shell for user %s " , user );
1439
+ AUDIT ("Failed adjusting shell for user \"%s\" " , user );
1440
1440
1441
1441
if (is_admin )
1442
1442
add_group (user , "wheel" );
0 commit comments