Skip to content

Commit 23a952f

Browse files
committed
zcore: add logon_np ZRPC
References: GXL-487, GXH-129, DESK-1731, DESK-2542, DESK-3393, DESK-3799
1 parent cff0c3a commit 23a952f

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

exch/zcore/names.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,15 @@ static constexpr const char *zcore_rpc_names[] = {
103103
E(logon_token),
104104
E(getuserfreebusy),
105105
E(getuserfreebusyical),
106+
E(logon_np),
106107
};
107108
#undef E
108109
#undef EXP
109110

110111
const char *zcore_rpc_idtoname(zcore_callid i)
111112
{
112113
auto j = static_cast<uint8_t>(i);
113-
static_assert(std::size(zcore_rpc_names) == static_cast<uint8_t>(zcore_callid::getuserfreebusyical) + 1);
114+
static_assert(std::size(zcore_rpc_names) == static_cast<uint8_t>(zcore_callid::logon_np) + 1);
114115
auto s = j < std::size(zcore_rpc_names) ? zcore_rpc_names[j] : nullptr;
115116
return znul(s);
116117
}

exch/zcore/rpc_ext.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,7 @@ pack_result rpc_ext_pull_request(const BINARY *pbin_in,
17121712
E(logon_token)
17131713
E(getuserfreebusy)
17141714
E(getuserfreebusyical)
1715+
E(logon_np)
17151716
#undef E
17161717
default:
17171718
return pack_result::bad_switch;
@@ -1831,6 +1832,7 @@ pack_result rpc_ext_push_response(const zcresp *presponse, BINARY *pbin_out)
18311832
E(logon_token)
18321833
E(getuserfreebusy)
18331834
E(getuserfreebusyical)
1835+
E(logon_np)
18341836
#undef E
18351837
default:
18361838
return pack_result::bad_switch;

exch/zcore/zserver.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,19 @@ ec_error_t zs_logon(const char *username, const char *password,
636636
return zs_logon_phase2(std::move(mres), phsession);
637637
}
638638

639+
ec_error_t zs_logon_np(const char *username, const char *password,
640+
const char *rhost, uint32_t flags, GUID *phsession)
641+
{
642+
sql_meta_result mres{};
643+
auto ret = mysql_adaptor_meta(username, WANTPRIV_METAONLY, mres);
644+
if (ret != 0) {
645+
mlog(LV_WARN, "rhost=[%s]:0 user=%s zs_logon_np rejected: %s",
646+
znul(rhost), username, mres.errstr.c_str());
647+
return ecLoginFailure;
648+
}
649+
return zs_logon_phase2(std::move(mres), phsession);
650+
}
651+
639652
ec_error_t zs_logon_token(const char *token, const char *rhost, GUID *phsession)
640653
{
641654
sql_meta_result mres{};

exch/zcore/zserver.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ extern void zs_notification_proc(const char *dir, BOOL table, uint32_t notify_id
6060
extern USER_INFO *zs_get_info();
6161
extern USER_INFO_REF zs_query_session(GUID);
6262
extern ec_error_t zs_logon_token(const char *token, const char *rhost, GUID *ses);
63+
extern ec_error_t zs_logon_np(const char *username, const char *password, const char *rhost, uint32_t flags, GUID *ses);
6364
extern ec_error_t zs_logon(const char *username, const char *password, const char *rhost, uint32_t flags, GUID *ses);
6465
extern ec_error_t zs_checksession(GUID ses);
6566
extern ec_error_t zs_uinfo(const char *username, BINARY *entryid, char **dispname, char **x500dn, uint32_t *priv_bits);

include/gromox/zcore_client.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,6 @@ ZCIDL(essdn_to_username, (const char *essdn, IDLOUT char **username))
101101
ZCIDL(logon_token, (const char *token, const char *rhost, IDLOUT GUID *hsession))
102102
ZCIDL(getuserfreebusy, (GUID hsession, BINARY entryid, time_t starttime, time_t endtime, IDLOUT std::vector<freebusy_event> *fb_events))
103103
ZCIDL(getuserfreebusyical, (GUID hsession, BINARY entryid, time_t starttime, time_t endtime, IDLOUT BINARY *ical_bin))
104+
ZCIDL(logon_np, (const char *username, const char *password, const char *rhost, uint32_t flags, IDLOUT GUID *hsession))
104105
#undef ZCIDL
105106
#undef IDLOUT

include/gromox/zcore_rpc.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ enum class zcore_callid : uint8_t {
104104
logon_token = 0x5a,
105105
getuserfreebusy = 0x5b,
106106
getuserfreebusyical = 0x5c,
107+
logon_np = 0x5d,
107108
/* update exch/zcore/names.cpp! */
108109
};
109110

@@ -124,6 +125,7 @@ struct zcreq_logon final : public zcreq {
124125
char *rhost;
125126
uint32_t flags;
126127
};
128+
using zcreq_logon_np = zcreq_logon;
127129

128130
struct zcreq_checksession final : public zcreq {
129131
GUID hsession;
@@ -926,6 +928,7 @@ using zcresp_submitmessage = zcresp;
926928
using zcresp_unadvise = zcresp;
927929
using zcresp_unloadobject = zcresp;
928930
using zcresp_vcftomessage = zcresp;
931+
using zcresp_logon_np = zcresp_logon;
929932

930933
enum {
931934
MXF_UNWRAP_SMIME_CLEARSIGNED = 0x1U,

0 commit comments

Comments
 (0)