summaryrefslogtreecommitdiff
path: root/NNTPRoutines.c
diff options
context:
space:
mode:
authorg8bpq <john.wiseman@cantab.net>2023-02-05 11:01:05 +0000
committerg8bpq <john.wiseman@cantab.net>2023-02-05 11:01:05 +0000
commitc32ef4ee1e742d14161b348d62f2c674a1a289e6 (patch)
tree2b8c9ec4840b5965a3a6d70614d5d4ea21967ff1 /NNTPRoutines.c
parentc15de2c7f7e70c97a89b591b3ece72c5047ab4fa (diff)
6.0.23.4623.51
Diffstat (limited to 'NNTPRoutines.c')
-rw-r--r--NNTPRoutines.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/NNTPRoutines.c b/NNTPRoutines.c
index 385f6a7..2875a06 100644
--- a/NNTPRoutines.c
+++ b/NNTPRoutines.c
@@ -973,7 +973,32 @@ VOID ProcessNNTPServerMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
*/
-
+
+ if(memcmp(Buffer, "DATE", 4) == 0)
+ {
+ //This command returns a one-line response code of 111 followed by the
+ //GMT date and time on the server in the form YYYYMMDDhhmmss.
+ // 111 YYYYMMDDhhmmss
+
+ struct tm *tm;
+ char Date[32];
+ time_t Time = time(NULL);
+
+ tm = gmtime(&Time);
+
+ if (tm)
+ {
+ sprintf_s(Date, sizeof(Date), "111 %04d%02d%02d%02d%02d%02d",
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
+
+ SendSock(sockptr, Date);
+ }
+ else
+ SendSock(sockptr, "500 command not recognized");
+
+ return;
+ }
+
SendSock(sockptr, "500 command not recognized");
return;