Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed ezmlm for gcc14 #5

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.repo-build
.repo-build.tmp
RCS
41 changes: 22 additions & 19 deletions ezmlm-x/auto-str.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
/*
* $Log: auto-str.c,v $
* Revision 1.8 2020-11-24 13:44:02+05:30 Cprogrammer
* removed exit.h
*
* Revision 1.7 2020-06-17 16:58:35+05:30 Cprogrammer
* make output readable
*
* Revision 1.6 2004-10-22 15:34:20+05:30 Cprogrammer
* replaced readwrite.h with unistd.h
*
* Revision 1.5 2004-07-17 21:15:59+05:30 Cprogrammer
* added RCS log
*
* $Id: auto-str.c,v 1.1 2025-01-22 11:21:30+05:30 Cprogrammer Exp mbhangui $
*/
#include <ctype.h>
#include <unistd.h>
#include "substdio.h"

char buf1[256];
substdio ss1 = SUBSTDIO_FDBUF(write, 1, buf1, sizeof(buf1));
substdio ss1 = SUBSTDIO_FDBUF((ssize_t(*)(int, char *, size_t)) write, 1, buf1, sizeof(buf1));

/*
* check if a given character can be printed unquoted in a C string
Expand All @@ -36,17 +24,14 @@ is_legible(unsigned char ch)
}

void
my_puts(s)
char *s;
my_puts(char *s)
{
if (substdio_puts(&ss1, s) == -1)
_exit(111);
}

int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
char *name;
char *value;
Expand Down Expand Up @@ -82,3 +67,21 @@ main(argc, argv)
/*- Not reached */
return(0);
}
/*
* $Log: auto-str.c,v $
* Revision 1.1 2025-01-22 11:21:30+05:30 Cprogrammer
* Fixes for gcc14
*
* Revision 1.8 2020-11-24 13:44:02+05:30 Cprogrammer
* removed exit.h
*
* Revision 1.7 2020-06-17 16:58:35+05:30 Cprogrammer
* make output readable
*
* Revision 1.6 2004-10-22 15:34:20+05:30 Cprogrammer
* replaced readwrite.h with unistd.h
*
* Revision 1.5 2004-07-17 21:15:59+05:30 Cprogrammer
* added RCS log
*
*/
77 changes: 40 additions & 37 deletions ezmlm-x/cookie.c
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
/*
* $Id: cookie.c,v 1.1 2025-01-22 11:21:30+05:30 Cprogrammer Exp mbhangui $
*/
#include "cookie.h"
#include "str.h"
#include "uint32.h"
#include "surfpcs.h"

void cookie(hash,key,keylen,date,addr,action)
char *hash;
char *key;
unsigned int keylen;
char *date;
char *addr;
char *action;
void
cookie(char *hash, char *key, size_t keylen, char *date, char *addr, char *action)
{
surfpcs s;
uint32 seed[32];
unsigned char out[32];
int i;
int j;
surfpcs s;
uint32 seed[32];
unsigned char out[32];
int i;
int j;

/*
step 1: create seed from key. note that this doesn't have to be
cryptographic; it simply has to avoid destroying the user's entropy.
if speed turns out to be a problem, switch to a CRC.
*/
for (i = 0;i < 32;++i) seed[i] = 0;
for (j = 0;j < 4;++j) {
surfpcs_init(&s,seed);
surfpcs_add(&s,key,keylen);
surfpcs_out(&s,out);
for (i = 0;i < 32;++i) seed[i] = (seed[i] << 8) + out[i];
}
/*
* step 1: create seed from key. note that this doesn't have to be
* cryptographic; it simply has to avoid destroying the user's entropy.
* if speed turns out to be a problem, switch to a CRC.
*/
for (i = 0; i < 32; ++i)
seed[i] = 0;
for (j = 0; j < 4; ++j) {
surfpcs_init(&s, seed);
surfpcs_add(&s, key, keylen);
surfpcs_out(&s, out);
for (i = 0; i < 32; ++i)
seed[i] = (seed[i] << 8) + out[i];
}

/*
step 2: apply SURF.
*/
surfpcs_init(&s,seed);
surfpcs_add(&s,date,str_len(date) + 1);
surfpcs_add(&s,addr,str_len(addr) + 1);
surfpcs_add(&s,action,1);
surfpcs_out(&s,out);
/*- step 2: apply SURF. */
surfpcs_init(&s, seed);
surfpcs_add(&s, date, str_len(date) + 1);
surfpcs_add(&s, addr, str_len(addr) + 1);
surfpcs_add(&s, action, 1);
surfpcs_out(&s, out);

/*
step 3: extract a readable cookie from the SURF output.
*/
for (i = 0;i < 20;++i)
hash[i] = 'a' + (out[i] & 15);
/*- step 3: extract a readable cookie from the SURF output. */
for (i = 0; i < 20; ++i)
hash[i] = 'a' + (out[i] & 15);
}

/*
* $Log: cookie.c,v $
* Revision 1.1 2025-01-22 11:21:30+05:30 Cprogrammer
* Fixes for gcc14
*
*/
3 changes: 2 additions & 1 deletion ezmlm-x/cookie.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef COOKIE_H
#define COOKIE_H
#include <sys/types.h>

#define COOKIE 20

extern void cookie();
extern void cookie(char *, char *, size_t, char *, char *, char *);

#endif
2 changes: 2 additions & 0 deletions ezmlm-x/doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Release 1.1 Start 10/05/2024 End 06/08/2024
2. qmail.c: changed for envdir.c change in libqmail
- 06/08/2024
3. qmail.c: fix compilation error for envdir call
- 22/01/2025
4. Fixes for gcc14

* Tue Jan 02 2024 00:09:59 +0530 Manvendra Bhangui <[email protected]> 7.2.3-1.1%{?dist}
Release 1.1 Start 24/07/2023 End 31/12/2023
Expand Down
102 changes: 57 additions & 45 deletions ezmlm-x/ezmlm-list.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*
* $Id: ezmlm-list.c,v 1.1 2025-01-22 11:21:30+05:30 Cprogrammer Exp mbhangui $
*/
#include <unistd.h>
#include "stralloc.h"
#include "substdio.h"
Expand All @@ -8,55 +11,64 @@
#include "open.h"

#define FATAL "ezmlm-list: fatal: "
void die_write()

char outbuf[1024], inbuf[1024];
substdio out = SUBSTDIO_FDBUF((ssize_t(*)(int, char *, size_t)) write, 1, outbuf, sizeof (outbuf));
substdio in;
stralloc line = { 0 };
char fn[14] = "subscribers/?";

void
die_write()
{
strerr_die2sys(111,FATAL,"unable to write: ");
strerr_die2sys(111, FATAL, "unable to write: ");
}

char outbuf[1024];
substdio out = SUBSTDIO_FDBUF(write,1,outbuf,sizeof(outbuf));
char inbuf[1024];
substdio in;
int
main(int argc, char **argv)
{
char *dir;
int fd;
int match;

stralloc line = {0};
dir = argv[1];
if (!dir)
strerr_die1x(100, "ezmlm-list: usage: ezmlm-list dir");

char fn[14] = "subscribers/?";
if (chdir(dir) == -1)
strerr_die4sys(111, FATAL, "unable to switch to ", dir, ": ");

int main(argc,argv)
int argc;
char **argv;
{
char *dir;
int fd;
int match;

dir = argv[1];
if (!dir) strerr_die1x(100,"ezmlm-list: usage: ezmlm-list dir");

if (chdir(dir) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",dir,": ");

for (fn[12] = 64;fn[12] < 64 + 53;++fn[12]) {
fd = open_read(fn);
if (fd == -1) {
if (errno != error_noent)
strerr_die4sys(111,FATAL,"unable to open ",fn,": ");
}
else {
substdio_fdbuf(&in,read,fd,inbuf,sizeof(inbuf));
for (;;) {
if (getln(&in,&line,&match,'\0') == -1)
strerr_die4sys(111,FATAL,"unable to read ",fn,": ");
if (!match) break;
if (line.s[str_chr(line.s,'\n')])
strerr_die3x(111,FATAL,"newline in ",fn);
if (substdio_puts(&out,line.s + 1)) die_write();
if (substdio_put(&out,"\n",1) == -1) die_write();
}
}

}

if (substdio_flush(&out) == -1) die_write();
_exit(0);
for (fn[12] = 64; fn[12] < 64 + 53; ++fn[12]) {
fd = open_read(fn);
if (fd == -1) {
if (errno != error_noent)
strerr_die4sys(111, FATAL, "unable to open ", fn, ": ");
} else {
substdio_fdbuf(&in, (ssize_t(*)(int, char *, size_t)) read, fd, inbuf, sizeof (inbuf));
for (;;) {
if (getln(&in, &line, &match, '\0') == -1)
strerr_die4sys(111, FATAL, "unable to read ", fn, ": ");
if (!match)
break;
if (line.s[str_chr(line.s, '\n')])
strerr_die3x(111, FATAL, "newline in ", fn);
if (substdio_puts(&out, line.s + 1))
die_write();
if (substdio_put(&out, "\n", 1) == -1)
die_write();
}
}

}

if (substdio_flush(&out) == -1)
die_write();
_exit(0);
}

/*
* $Log: ezmlm-list.c,v $
* Revision 1.1 2025-01-22 11:21:30+05:30 Cprogrammer
* Fixes for gcc14
*
*/
Loading
Loading