Skip to content

Commit

Permalink
updated smtpd.c, buffer_defs.h
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhangui committed Jul 16, 2024
1 parent 57e696f commit 41b477f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
6 changes: 5 additions & 1 deletion indimail-mta-x/buffer_defs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: buffer_defs.h,v 1.1 2024-02-19 19:31:13+05:30 Cprogrammer Exp mbhangui $
* $Id: buffer_defs.h,v 1.2 2024-07-16 08:16:15+05:30 Cprogrammer Exp mbhangui $
*/
#ifndef BUFFER_DEFS_H
#define BUFFER_DEFS_H
Expand All @@ -20,6 +20,10 @@
#define BUFSIZE_SMALL 128
#endif

#ifndef BUFSIZE_MEDIUM
#define BUFSIZE_MEDIUM 256
#endif

#ifndef BUFSIZE_OUT
#define BUFSIZE_OUT 512
#endif
Expand Down
1 change: 1 addition & 0 deletions indimail-mta-x/doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Release @version@-@release@ Start 05/02/2024 End XX/XX/XXXX
20. indimail-mta.spec.in: turn of logging for clamd, freshclam before removal
- 16/07/2024
21. smtpd.c, qmail-remote.c: add XOAUTH2 auth methods
22. buffer_defs.h: added defination for BUFSIZE_MEDIUM

* Sun Mar 03 2024 12:20:15 +0000 Manvendra Bhangui <indimail-mta@indimail.org> 3.0.7-1.1%{?dist}
Release 3.0.7-1.1 Start 02/01/2024 End 03/02/2024
Expand Down
21 changes: 12 additions & 9 deletions indimail-mta-x/smtpd.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* RCS log at bottom
* $Id: smtpd.c,v 1.328 2024-07-16 00:17:49+05:30 Cprogrammer Exp mbhangui $
* $Id: smtpd.c,v 1.328 2024-07-16 08:16:35+05:30 Cprogrammer Exp mbhangui $
*/
#include <unistd.h>
#include <fcntl.h>
Expand Down Expand Up @@ -228,7 +228,7 @@ static char ssoutbuf[BUFSIZE_OUT];
static substdio ssout = SUBSTDIO_FDBUF(safewrite, 1, ssoutbuf, sizeof ssoutbuf);
static char sserrbuf[BUFSIZE_OUT];
static substdio sserr = SUBSTDIO_FDBUF(write, 2, sserrbuf, sizeof (sserrbuf));
static char upbuf[BUFSIZE_SMALL];
static char upbuf[BUFSIZE_MEDIUM];
static substdio ssup;

static my_ulong databytes = 0;
Expand Down Expand Up @@ -5187,13 +5187,11 @@ authenticate(int method)
#endif
substdio_fdbuf(&ssup, safewrite, pi[1], upbuf, sizeof upbuf);
strnum[0] = method;
if (!stralloc_copyb(&authmethod, strnum, 1) ||
!stralloc_0(&authmethod))
die_nomem();
strnum[1] = '\0';
if (substdio_put(&ssup, user.s, user.len) == -1 ||
substdio_put(&ssup, pass.s, pass.len) == -1 ||
substdio_put(&ssup, resp.s, resp.len) == -1 ||
substdio_put(&ssup, authmethod.s, authmethod.len) == -1 ||
substdio_put(&ssup, strnum, 2) == -1 ||
substdio_flush(&ssup) == -1)
return err_write();
close(pi[1]);
Expand Down Expand Up @@ -6443,9 +6441,14 @@ smtp_auth(const char *arg)
sleep(penalty);
#ifdef AUTH_XOAUTH2
if (case_equals(authcmds[i].text, "xoauth2")) {
if (!stralloc_copyb(&tmpBuf, "https://", 8) ||
!stralloc_cats(&tmpBuf, hostname) ||
!stralloc_append(&tmpBuf, "/") ||
!stralloc_0(&tmpBuf))
die_nomem();
scope = env_get("XOAUTH2_SCOPE");
if (!stralloc_copyb(&slop, "{\"status\":\"401\",\"schemes\":bearer mac\",\"scope\":\"", 47) ||
!stralloc_cats(&slop, scope ? scope : "https://github.com/indimail/indimail-mta/") ||
!stralloc_cats(&slop, scope ? scope : tmpBuf.s) ||
!stralloc_catb(&slop, "\"}", 2))
die_nomem();
if (b64encode(&slop, &resp) < 0 || !stralloc_0(&resp))
Expand Down Expand Up @@ -7484,7 +7487,7 @@ addrrelay()

/*
* $Log: smtpd.c,v $
* Revision 1.328 2024-07-16 00:17:49+05:30 Cprogrammer
* Revision 1.328 2024-07-16 08:16:35+05:30 Cprogrammer
* added XOAUTH2 auth method
*
* Revision 1.327 2024-05-16 18:31:07+05:30 Cprogrammer
Expand Down Expand Up @@ -7928,7 +7931,7 @@ addrrelay()
const char *
getversion_smtpd_c()
{
const char *x = "$Id: smtpd.c,v 1.328 2024-07-16 00:17:49+05:30 Cprogrammer Exp mbhangui $";
const char *x = "$Id: smtpd.c,v 1.328 2024-07-16 08:16:35+05:30 Cprogrammer Exp mbhangui $";

x++;
return revision + 11;
Expand Down

0 comments on commit 41b477f

Please sign in to comment.