Skip to content

Commit 5647380

Browse files
committed
Fixed #8859: Services cannot work with user names containing space when embedded access is used
1 parent 4fe41a5 commit 5647380

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/jrd/svc.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ void Service::getOptions(ClumpletReader& spb)
273273
{
274274
case isc_spb_user_name:
275275
spb.getString(svc_username);
276+
svc_orig_username = svc_username;
276277
fb_utils::dpbItemUpper(svc_username);
277278
break;
278279

@@ -694,8 +695,8 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d
694695
svc_resp_alloc(getPool()), svc_resp_buf(0), svc_resp_ptr(0), svc_resp_buf_len(0),
695696
svc_resp_len(0), svc_flags(SVC_finished), svc_user_flag(0), svc_spb_version(0),
696697
svc_shutdown_server(false), svc_shutdown_request(false),
697-
svc_shutdown_in_progress(false), svc_timeout(false),
698-
svc_username(getPool()), svc_sql_role(getPool()), svc_auth_block(getPool()),
698+
svc_shutdown_in_progress(false), svc_timeout(false), svc_username(getPool()),
699+
svc_orig_username(getPool()), svc_sql_role(getPool()), svc_auth_block(getPool()),
699700
svc_expected_db(getPool()), svc_trusted_role(false), svc_utf8(false),
700701
svc_switches(getPool()), svc_perm_sw(getPool()), svc_address_path(getPool()),
701702
svc_command_line(getPool()), svc_parallel_workers(0),
@@ -2067,17 +2068,15 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data)
20672068
if (svc_username.hasData())
20682069
{
20692070
string auth = "-user ";
2070-
auth += svc_username;
2071-
auth += ' ';
2071+
UtilSvc::addStringWithSvcTrmntr(svc_orig_username, auth);
20722072
svc_switches = auth + svc_switches;
20732073
}
20742074
}
20752075

20762076
if (svc_sql_role.hasData())
20772077
{
20782078
string auth = "-role ";
2079-
auth += svc_sql_role;
2080-
auth += ' ';
2079+
UtilSvc::addStringWithSvcTrmntr(svc_sql_role, auth);
20812080
svc_switches = auth + svc_switches;
20822081
}
20832082
}

src/jrd/svc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ class Service : public Firebird::UtilSvc, public TypedHandle<type_svc>
323323
char* svc_arg_ptr;
324324

325325
Firebird::string svc_username;
326+
Firebird::string svc_orig_username;
326327
Firebird::string svc_sql_role;
327328
Firebird::AuthReader::AuthBlock svc_auth_block;
328329
Firebird::PathName svc_expected_db;

0 commit comments

Comments
 (0)