Skip to content

Commit 716671d

Browse files
committed
ews: unconditionally emit all OOF XML tags upon GetUserOofSettingsRequest
Outlook 2019 MSO (v2506 Build 16.0.18925.20076) is prone to reliable crashing when attempting to save OOF settings after miniscule changes. Not all OL versions exhibit the behavior, but if one {version, mailbox} combination does crash, it does quite reliably so. It appears that the crash is averted when *all* OOF XML tags are present at all times, even if OOF is disabled. This suggests that OL (1.) violates specification MS-OXWOOF v16 §2.2.4.2 which clearly permits absence of some tags, (2.) has a nullptr deference somewhere, akin to: ``` // on GetUserOofSettings: this->starttime = xmlFindNode(tree, "StartTime"); // on SetUserOofSettings: this->starttime->set("2025-12-01 00:00:00"); ``` References: GXL-605, DESK-3609, DESK-3614, DESK-3666
1 parent c4dd52f commit 716671d

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

doc/outlook_oof_spec.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ Editing the FAI messages' ``PR_BODY`` will not change the automatic reply body.
2828
Changing e.g. the ``PR_MESSAGE_CLASS`` however will make Exchange stop sending
2929
the reply, even if it is changed back afterwards.
3030

31-
Internet search suggests that OOF is set using the EWS API instead.
31+
OOF is get/set by Outlook using the EWS API instead.
3232

33-
MAPI only gets gratitious copies, and only of certain information, making it
34-
practically useless.
33+
MAPI only gets gratitious copies, and only of certain information, making
34+
those copies practically useless.
3535

3636

3737
OOF levels

exch/ews/requests.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -944,10 +944,10 @@ void process(mGetUserOofSettingsRequest&& request, XMLElement* response, const E
944944
std::string maildir = ctx.get_maildir(request.Mailbox);
945945
string configPath = maildir+"/config/autoreply.cfg";
946946
auto configFile = config_file_init(configPath.c_str(), oof_defaults);
947-
if (configFile) {
948-
auto oof_state = configFile->get_ll("oof_state");
949-
auto allow_external_oof = configFile->get_ll("allow_external_oof");
950-
auto external_audience = configFile->get_ll("external_audience");
947+
unsigned int oof_state = configFile != nullptr ? configFile->get_ll("oof_state") : 0;
948+
bool allow_external_oof = configFile != nullptr ? configFile->get_ll("allow_external_oof") : false;
949+
bool external_audience = configFile != nullptr ? configFile->get_ll("external_audience") : false;
950+
if (true) {
951951
switch(oof_state) {
952952
case 1:
953953
data.OofSettings->OofState = "Enabled"; break;
@@ -966,15 +966,20 @@ void process(mGetUserOofSettingsRequest&& request, XMLElement* response, const E
966966
tDuration& Duration = data.OofSettings->Duration.emplace();
967967
Duration.StartTime = clock::from_time_t(strtoll(start_time, nullptr, 0));
968968
Duration.EndTime = clock::from_time_t(strtoll(end_time, nullptr, 0));
969+
} else {
970+
auto &dur = data.OofSettings->Duration.emplace();
971+
dur.StartTime = clock::now();
972+
dur.EndTime = dur.StartTime + std::chrono::days(1);
969973
}
970974
optional<string> reply = readMessageBody(maildir+"/config/internal-reply");
971975
if (reply)
972976
data.OofSettings->InternalReply.emplace(std::move(reply));
977+
else
978+
data.OofSettings->InternalReply.emplace(std::string{});
973979
if ((reply = readMessageBody(maildir+"/config/external-reply")))
974980
data.OofSettings->ExternalReply.emplace(std::move(reply));
975-
} else {
976-
data.OofSettings->OofState = "Disabled";
977-
data.OofSettings->ExternalAudience = "None";
981+
else
982+
data.OofSettings->ExternalReply.emplace(std::string{});
978983
}
979984

980985
//Finalize response

0 commit comments

Comments
 (0)