MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / API_ROUTINE isc_modify_user

Function API_ROUTINE isc_modify_user

src/yvalve/alt.cpp:957–1018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

955}
956
957ISC_STATUS API_ROUTINE isc_modify_user(ISC_STATUS* status, const USER_SEC_DATA* input_user_data)
958{
959/**************************************
960 *
961 * i s c _ m o d i f y _ u s e r
962 *
963 **************************************
964 *
965 * Functional description
966 * Adds a user to the server's security
967 * database.
968 * Return 0 if the user was added
969 *
970 * Return > 0 if any error occurs.
971 *
972 **************************************/
973 Auth::UserData userInfo;
974 userInfo.op = Auth::MOD_OPER;
975 Firebird::LocalStatus s;
976 Firebird::CheckStatusWrapper statusWrapper(&s);
977
978 if (input_user_data->user_name)
979 {
980 Firebird::string work = input_user_data->user_name;
981 if (work.length() > USERNAME_LENGTH) {
982 return user_error(status, isc_usrname_too_long);
983 }
984
985 Firebird::string::size_type l = work.find(' ');
986 if (l != Firebird::string::npos) {
987 work.resize(l);
988 }
989
990 userInfo.user.set(&statusWrapper, work.c_str());
991 check(&statusWrapper);
992 userInfo.user.setEntered(&statusWrapper, 1);
993 check(&statusWrapper);
994 }
995 else {
996 return user_error(status, isc_usrname_required);
997 }
998
999 if (input_user_data->password)
1000 {
1001 userInfo.pass.set(&statusWrapper, input_user_data->password);
1002 check(&statusWrapper);
1003 userInfo.pass.setEntered(&statusWrapper, 1);
1004 check(&statusWrapper);
1005 }
1006 else {
1007 return user_error(status, isc_password_required);
1008 }
1009
1010 copyField(userInfo.u, input_user_data->uid, input_user_data->sec_flags & sec_uid_spec);
1011 copyField(userInfo.g, input_user_data->gid, input_user_data->sec_flags & sec_gid_spec);
1012 copyField(userInfo.group, input_user_data->group_name, input_user_data->sec_flags & sec_group_name_spec);
1013 copyField(userInfo.first, input_user_data->first_name, input_user_data->sec_flags & sec_first_name_spec);
1014 copyField(userInfo.middle, input_user_data->middle_name, input_user_data->sec_flags & sec_middle_name_spec);

Callers

nothing calls this directly

Calls 10

user_errorFunction · 0.85
copyFieldFunction · 0.85
executeSecurityCommandFunction · 0.85
checkFunction · 0.50
lengthMethod · 0.45
findMethod · 0.45
resizeMethod · 0.45
setMethod · 0.45
c_strMethod · 0.45
setEnteredMethod · 0.45

Tested by

no test coverage detected