Skip to content

Commit 7dd9316

Browse files
juliaschroederjengelh
authored andcommitted
mysql_adaptor: add domain_id field to sql_user
1 parent 85ea14b commit 7dd9316

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

exch/mysql_adaptor/sql2.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static bool propmap_load(sqlconn &conn, const char *query, propmap_t &out)
283283
}
284284

285285
static int userlist_parse(sqlconn &conn, const char *query,
286-
aliasmap_t &amap, propmap_t &pmap, std::vector<sql_user> &pfile)
286+
aliasmap_t &amap, propmap_t &pmap, std::vector<sql_user> &pfile, unsigned int domain_id=0)
287287
{
288288
if (!conn.query(query))
289289
return false;
@@ -294,6 +294,7 @@ static int userlist_parse(sqlconn &conn, const char *query,
294294
for (size_t i = 0; i < result.num_rows(); ++i) {
295295
auto row = result.fetch_row();
296296
sql_user u;
297+
u.domain_id = domain_id;
297298
u.dtypx = DT_MAILUSER;
298299
if (row[2] != nullptr)
299300
u.dtypx = static_cast<enum display_type>(strtoul(row[2], nullptr, 0));
@@ -357,7 +358,7 @@ int mysql_adaptor_get_domain_users(unsigned int domain_id,
357358
"LEFT JOIN classes AS cl ON u.username=cl.listname "
358359
"LEFT JOIN `groups` AS `gr` ON `u`.`username`=`gr`.`groupname` "
359360
"WHERE u.domain_id=%u AND u.group_id=0", domain_id);
360-
return userlist_parse(*conn, query, amap, pmap, pfile);
361+
return userlist_parse(*conn, query, amap, pmap, pfile, domain_id);
361362
} catch (const std::exception &e) {
362363
mlog(LV_ERR, "mysql_adaptor: %s %s", __func__, e.what());
363364
return false;

include/gromox/mysql_adaptor.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct sql_user {
8383
enum display_type dtypx = DT_MAILUSER;
8484
unsigned int id = 0;
8585
unsigned int addr_status = AF_USER_DELETED;
86+
unsigned int domain_id = 0;
8687
enum mlist_type list_type = mlist_type::normal;
8788
uint32_t hidden = 0;
8889
unsigned int list_priv = 0, homeserver_id = 0;

0 commit comments

Comments
 (0)