Commit d595ac3e authored by Justin Mitchell's avatar Justin Mitchell

mesg edit function was not dropping egid only euid. will no longer build

with -fpie. Update the credits a little
parent 9198dd40
......@@ -55,8 +55,8 @@ WARNINGS = \
# until gcc catches up (4.7.x is good)
WARNINGS += $(shell if [ $(GCCVER) -lt 0406 ] ; then echo "-Wno-multichar"; fi )
CCSEC = -fpie -fstack-protector-all
LDSEC = -pie -Wl,-z,relro,-z,now
CCSEC = -fstack-protector-all
LDSEC = -Wl,-z,relro,-z,now
# info strings, do not edit.
DEFS:= -DBUILD_DATE=\"$(shell date +%Y%m%d)\"
Milliways III
Copyright (c) 1992-2006 Justin Mitchell <>
Copyright (c) 1992-2016 Justin Mitchell <>
Justin "Arthur Dent" Mitchell (Alpha Spod)
Justin "Arthur" Mitchell (Alpha Spod)
Alan "anarchy" Cox (Linux/Internet patches, command parser)
Chris "Fry" Fry (many features including MUD rooms)
Finn "finnw" Wilcox (I/O multiplexing, hash tables)
Steve "FireFury" Hill (debugging wrappers)
Steve "FireFury" Hill (debugging wrappers, comms)
Chris "cmckenna" McKenna (MUD rooms, gags)
Denis "Dez" Walker (manpage style help, testing)
Peter "pwb" Berry (UTF-8 compatibility, rpm maintenance)
Andy "welshbyte" Price (refactoring and general code tidying)
Thanks also to:
Jonathan "Arashi" Care (ideas)
Telsa "hobbit" Gwynne (spelling)
......@@ -25,20 +25,27 @@
extern struct user * const user;
/* drop and restore user level privs */
static int private_myid = -1;
static int private_myuid = -1;
static int private_mygid = -1;
int perms_drop(void)
if (seteuid(getuid()) == -1) return -1;
return private_myid;
if (setegid(getgid()) == -1) return -1;
return private_myuid;
void perms_restore(void)
if (private_myid != -1) {
private_myid = -1;
if (private_myuid != -1) {
private_myuid = -1;
if (private_mygid != -1) {
private_mygid = -1;
......@@ -932,6 +932,7 @@ static void credits(void)
printf("Dez (man page style help, ideas, testing),\n");
printf("Pwb (RPM packaging, UTF-8 compatibility hacks),\n");
printf("Psycodom (Fixups for IPC, JS, locale conversions, buffer overflows)\n");
printf("welshbyte (Code refactoring, tidying and general cleanups\n");
......@@ -2,6 +2,7 @@
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <stddef.h>
#include <mesg.h>
#include "bb.h"
......@@ -10,12 +11,11 @@
#include "folders.h"
static void addmap(char *map, const char *name, char key,
unsigned long size, void * offset, void * base)
size_t size, size_t offset)
int i;
unsigned long start = (unsigned long)offset - (unsigned long)base;
printf("-%c %-20s %4lu bytes @%lu\n", key, name, size, start);
for (i=start;i<start+size;i++)
printf("-%c %-20s %4lu bytes @%lu\n", key, name, size, offset);
for (i=offset;i<offset+size;i++)
......@@ -43,26 +43,26 @@ int main(int argc, char ** argv)
printf("struct person = %lu bytes\n",sizeof(struct person));
map = malloc(sizeof(struct person));
memset(map, 0, sizeof(struct person));
addmap(map, "name", 'N', sizeof(, &, &pp );
addmap(map, "passwd", 'P', sizeof(pp.passwd), &pp.passwd, &pp );
addmap(map, "lastlogout", 'l', sizeof(pp.lastlogout), &pp.lastlogout, &pp );
addmap(map, "folders", 'f', sizeof(pp.folders), &pp.folders, &pp );
addmap(map, "status", 's', sizeof(pp.status), &pp.status, &pp );
addmap(map, "special", 'S', sizeof(pp.special), &pp.special, &pp );
addmap(map, "lastread", 'L', sizeof(pp.lastread), &pp.lastread, &pp );
addmap(map, "realname", 'R', sizeof(pp.realname), &pp.realname, &pp );
addmap(map, "contact", 'C', sizeof(, &, &pp );
addmap(map, "timeused", 't', sizeof(pp.timeused), &pp.timeused, &pp );
addmap(map, "idletime", 'i', sizeof(pp.idletime), &pp.idletime, &pp );
addmap(map, "groups", 'g', sizeof(pp.groups), &pp.groups, &pp );
addmap(map, "doing", 'd', sizeof(pp.doing), &pp.doing, &pp );
addmap(map, "dowhen", 'w', sizeof(pp.dowhen), &pp.dowhen, &pp );
addmap(map, "timeout", 'T', sizeof(pp.timeout), &pp.timeout, &pp );
addmap(map, "spare", '_', sizeof(pp.spare), &pp.spare, &pp );
addmap(map, "colour", 'c', sizeof(pp.colour), &pp.colour, &pp );
addmap(map, "room", 'r', sizeof(, &, &pp );
addmap(map, "chatprivs", 'C', sizeof(pp.chatprivs), &pp.chatprivs, &pp );
addmap(map, "chatmode", 'm', sizeof(pp.chatmode), &pp.chatmode, &pp );
addmap(map, "name", 'N', sizeof(, offsetof(struct person, name));
addmap(map, "passwd", 'P', sizeof(pp.passwd), offsetof(struct person, passwd));
addmap(map, "lastlogout", 'l', sizeof(pp.lastlogout), offsetof(struct person, lastlogout));
addmap(map, "folders", 'f', sizeof(pp.folders), offsetof(struct person, folders));
addmap(map, "status", 's', sizeof(pp.status), offsetof(struct person, status));
addmap(map, "special", 'S', sizeof(pp.special), offsetof(struct person, special));
addmap(map, "lastread", 'L', sizeof(pp.lastread), offsetof(struct person, lastread));
addmap(map, "realname", 'R', sizeof(pp.realname), offsetof(struct person, realname));
addmap(map, "contact", 'C', sizeof(, offsetof(struct person, contact));
addmap(map, "timeused", 't', sizeof(pp.timeused), offsetof(struct person, timeused));
addmap(map, "idletime", 'i', sizeof(pp.idletime), offsetof(struct person, idletime));
addmap(map, "groups", 'g', sizeof(pp.groups), offsetof(struct person, groups));
addmap(map, "doing", 'd', sizeof(pp.doing), offsetof(struct person, doing));
addmap(map, "dowhen", 'w', sizeof(pp.dowhen), offsetof(struct person, dowhen));
addmap(map, "timeout", 'T', sizeof(pp.timeout), offsetof(struct person, timeout));
addmap(map, "spare", '_', sizeof(pp.spare), offsetof(struct person, spare));
addmap(map, "colour", 'c', sizeof(pp.colour), offsetof(struct person, colour));
addmap(map, "room", 'r', sizeof(, offsetof(struct person, room));
addmap(map, "chatprivs", 'C', sizeof(pp.chatprivs), offsetof(struct person, chatprivs));
addmap(map, "chatmode", 'm', sizeof(pp.chatmode), offsetof(struct person, chatmode));
showmap(map,sizeof(struct person));
......@@ -71,16 +71,16 @@ int main(int argc, char ** argv)
map = malloc(sizeof(struct Header));
memset(map, 0, sizeof(struct Header));
addmap(map, "Ref", 'R', sizeof(hh.Ref), &hh.Ref, &hh );
addmap(map, "date", 'd', sizeof(, &, &hh );
addmap(map, "from", 'f', sizeof(hh.from), &hh.from, &hh );
addmap(map, "to", 't', sizeof(, &, &hh );
addmap(map, "subject",'S', sizeof(hh.subject), &hh.subject, &hh );
addmap(map, "datafield",'D', sizeof(hh.datafield), &hh.datafield, &hh );
addmap(map, "size", 'z', sizeof(hh.size), &hh.size, &hh );
addmap(map, "status", 's', sizeof(hh.status), &hh.status, &hh );
addmap(map, "replyto", 'r', sizeof(hh.replyto), &hh.replyto, &hh );
addmap(map, "spare", '_', sizeof(hh.spare), &hh.spare, &hh );
addmap(map, "Ref", 'R', sizeof(hh.Ref), offsetof(struct Header, Ref));
addmap(map, "date", 'd', sizeof(, offsetof(struct Header, date));
addmap(map, "from", 'f', sizeof(hh.from), offsetof(struct Header, from));
addmap(map, "to", 't', sizeof(, offsetof(struct Header, to));
addmap(map, "subject",'S', sizeof(hh.subject), offsetof(struct Header, subject));
addmap(map, "datafield",'D', sizeof(hh.datafield), offsetof(struct Header, datafield));
addmap(map, "size", 'z', sizeof(hh.size), offsetof(struct Header, size));
addmap(map, "status", 's', sizeof(hh.status), offsetof(struct Header, status));
addmap(map, "replyto", 'r', sizeof(hh.replyto), offsetof(struct Header, replyto));
addmap(map, "spare", '_', sizeof(hh.spare), offsetof(struct Header, spare));
showmap(map,sizeof(struct Header));
......@@ -89,14 +89,14 @@ int main(int argc, char ** argv)
printf("struct folder = %lu bytes\n",sizeof(struct folder));
map = malloc(sizeof(struct folder));
memset(map, 0, sizeof(struct folder));
addmap(map, "status", 's', sizeof(ff.status), &ff.status, &ff );
addmap(map, "name", 'n', sizeof(, &, &ff );
addmap(map, "topic", 't', sizeof(ff.topic), &ff.topic, &ff );
addmap(map, "first", 'f', sizeof(ff.first), &ff.first, &ff );
addmap(map, "last", 'l', sizeof(ff.last), &ff.last, &ff );
addmap(map, "g_status", 'g', sizeof(ff.g_status), &ff.g_status, &ff );
addmap(map, "groups", 'r', sizeof(ff.groups), &ff.groups, &ff );
addmap(map, "spare", '_', sizeof(ff.spare), &ff.spare, &ff );
addmap(map, "status", 's', sizeof(ff.status), offsetof(struct folder, status));
addmap(map, "name", 'n', sizeof(, offsetof(struct folder, name));
addmap(map, "topic", 't', sizeof(ff.topic), offsetof(struct folder, topic));
addmap(map, "first", 'f', sizeof(ff.first), offsetof(struct folder, first));
addmap(map, "last", 'l', sizeof(ff.last), offsetof(struct folder, last));
addmap(map, "g_status", 'g', sizeof(ff.g_status), offsetof(struct folder, g_status));
addmap(map, "groups", 'r', sizeof(ff.groups), offsetof(struct folder, groups));
addmap(map, "spare", '_', sizeof(ff.spare), offsetof(struct folder, spare));
showmap(map,sizeof(struct folder));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment