Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bif_set_user_id (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
- {
- query_instance_t *qi = (query_instance_t *) QST_INSTANCE (qst);
- client_connection_t * cli = qi->qi_client;
- caddr_t uname = bif_string_arg (qst, args, 0, "__set_user_id");
- long mode = BOX_ELEMENTS (args) > 1 ? (long) bif_long_arg (qst, args, 1, "__set_user_id") : 1;
- caddr_t pass = BOX_ELEMENTS (args) > 2 ? bif_string_arg (qst, args, 2, "__set_user_id") : NULL;
- user_t * user = sec_name_to_user (uname);
- if (!user /*|| !user->usr_is_sql*/ || user->usr_is_role)
- sqlr_new_error ("22023", "HT042", "Not valid user id \"%s\"", uname);
- if (pass && (0 != strcmp (pass, user->usr_pass) || user->usr_disabled))
- sqlr_new_error ("22023", "HT042", "Invalid credentials for user id \"%s\"", uname);
- if (!pass)
- sec_check_dba ((query_instance_t *) qst, "__set_user_id");
- set_user_id (cli, uname, NULL);
- qi->qi_pop_user = mode;
- qi->qi_u_id = user->usr_id;
- qi->qi_g_id = user->usr_g_id;
- return (box_num (0));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement