# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
-timestamp='2006-07-02'
+timestamp='2006-09-20'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
+ | score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
sei)
basic_machine=mips-sei
os=-seiux
# system, and we'll never get to this point.
case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
spu-*)
os=-elf
;;
snprintf(buf, sizeof buf,
"The global system configuration has been edited by %s.\n",
CC->curr_user);
- aide_message(buf);
+ aide_message(buf,"Citadel Configuration Manager Message");
if (strlen(config.c_logpages) > 0)
create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
" This log file is no longer in use "
"and may be safely deleted.\n",
*file, strerror(errno));
- aide_message(errmsg);
+ aide_message(errmsg, "Database Warning Message");
}
}
free(list);
-shlibs:Depends=libc6 (>= 2.3.6-6), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8b-1)
+shlibs:Depends=libc6 (>= 2.3.6-6), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8c-1)
-shlibs:Depends=libc6 (>= 2.3.6-6), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8b-1)
+shlibs:Depends=libc6 (>= 2.3.6-6), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8c-1)
misc:Depends=debconf (>= 0.5) | debconf-2.0
-shlibs:Depends=libc6 (>= 2.3.6-6), libdb4.3 (>= 4.3.28-1), libldap2 (>= 2.1.17-1), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8b-1), zlib1g (>= 1:1.2.1)
+shlibs:Depends=libc6 (>= 2.3.6-6), libdb4.4, libldap2 (>= 2.1.17-1), libncurses5 (>= 5.4-5), libsieve2-1, libssl0.9.8 (>= 0.9.8c-1), zlib1g (>= 1:1.2.1)
/*
* Validate recipients, count delivery types and errors, and handle aliasing
* FIXME check for dupes!!!!!
- * Returns 0 if all addresses are ok, -1 if no addresses were specified,
- * or the number of addresses found invalid.
+ * Returns 0 if all addresses are ok, ret->num_error = -1 if no addresses
+ * were specified, or the number of addresses found invalid.
+ * caller needs to free the result.
*/
struct recptypes *validate_recipients(char *supplied_recipients) {
struct recptypes *ret;
/* $Id$ */
-#define aide_message(text) quickie_message("Citadel",NULL,NULL,AIDEROOM,text,0,NULL)
+#define aide_message(text, subject) quickie_message("Citadel",NULL,NULL,AIDEROOM,text,0,subject)
enum {
MSGS_ALL,
}
snprintf(buf, sizeof buf, "The room \"%s\" has been edited by %s.\n",
CC->room.QRname, CC->curr_user);
- aide_message(buf);
+ aide_message(buf, "Room modification Message");
cprintf("%d Ok\n", CIT_OK);
}
snprintf(buf, sizeof buf,
"There is now no room aide for \"%s\".\n",
CC->room.QRname);
- aide_message(buf);
+ aide_message(buf, "Aide Room Modification");
}
cprintf("%d Ok\n", CIT_OK);
}
/* tell the world what we did */
snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n",
deleted_room_name, CC->curr_user);
- aide_message(msg);
+ aide_message(msg, "Room Purger Message");
cprintf("%d '%s' deleted.\n", CIT_OK, deleted_room_name);
} else {
cprintf("%d ok to delete.\n", CIT_OK);
((newflags & QR_PASSWORDED) ? " Password: " : ""),
((newflags & QR_PASSWORDED) ? new_room_pass : "")
);
- aide_message(notification_message);
+ aide_message(notification_message, "Room Creation Message");
free(notification_message);
cprintf("%d '%s' has been created.\n", CIT_OK, new_room_name);
++num_rooms_purged;
}
- if (num_rooms_purged > 0) aide_message(transcript);
+ if (num_rooms_purged > 0) aide_message(transcript, "Room Autopurger Message");
free(transcript);
lprintf(CTDL_DEBUG, "Purged %d rooms.\n", num_rooms_purged);
++num_users_purged;
}
- if (num_users_purged > 0) aide_message(transcript);
+ if (num_users_purged > 0) aide_message(transcript,"User Purge Message");
free(transcript);
lprintf(CTDL_DEBUG, "Purged %d users.\n", num_users_purged);
struct ProtoFunctionHook *next;
} *ProtoHookList = NULL;
+
+#define ERR_PORT (1 << 1)
+
+
+static char *portlist = NULL;
+static size_t nSizPort = 0;
+
+static char *errormessages = NULL;
+static size_t nSizErrmsg = 0;
+
+
+static long DetailErrorFlags;
+
+
+char *ErrSubject = "Startup Problems";
+char *ErrGeneral = "Citadel had trouble on starting up. %s This means, citadel won't be the service provider for a specific service you configured it to.\n\n"
+"If you don't want citadel to provide these services, turn them off in WebCit via %s%s\n\n%s\n\n"
+"To make both ways actualy take place restart the citserver with \"sendcommand down\"\n\n"
+"The errors returned by the system were:\n%s\n";
+
+
+char *ErrPortShort = "We couldn't bind all ports you configured to be provided by citadel server.";
+char *ErrPortWhere = "Admin->System Preferences->Network.\n\nThe failed ports and sockets are: ";
+char *ErrPortHint = "If you want citadel to provide you with that functionality, "
+"check the output of \"netstat -lnp\" on linux Servers or \"netstat -na\" on *BSD"
+" and stop the programm, that binds these ports. You should eventually remove "
+" their initscripts in /etc/init.d so that you won't get this trouble once more.\n";
+
+
+void LogPrintMessages(long err)
+{
+ char *List, *DetailList, *Short, *Where, *Hint, *Message;
+ int n = nSizPort + nSizErrmsg + 5;
+
+ Message = (char*) malloc(n * SIZ);
+
+ switch (err)
+ {
+ case ERR_PORT:
+ Short = ErrPortShort;
+ Where = ErrPortWhere;
+ Hint = ErrPortHint;
+ List = portlist;
+ DetailList = errormessages;
+ break;
+ default:
+ Short = "";
+ Where = "";
+ Hint = "";
+ List = "";
+ DetailList = "";
+ }
+
+
+ snprintf(Message, n * SIZ, ErrGeneral, Short, Where, List, Hint, DetailList);
+
+ quickie_message("Citadel", NULL, NULL, AIDEROOM, Message, FMT_FIXED, ErrSubject);
+ free(Message);
+}
+
+
+
+void AppendString(char **target, char *append, size_t *len, size_t rate)
+{
+ size_t oLen = 0;
+ long AddLen;
+ long RelPtr = 0;
+
+ AddLen = strlen(append);
+
+ if (*len == 0)
+ {
+ *len = rate;
+
+ *target = (char*)malloc (*len * SIZ);
+ }
+ else
+ {
+ oLen = strlen(*target);
+ RelPtr = strlen(*target);
+ if (oLen + AddLen + 2 > *len * SIZ)
+ {
+ char *Buff = *target;
+ size_t NewSiz = *len + 10;
+ *target = malloc (NewSiz * SIZ);
+ memcpy (*target, Buff, NewSiz * SIZ);
+ *len = NewSiz;
+ }
+ }
+ memcpy (*target + oLen, append, AddLen);
+ (*target)[AddLen + 1] = '\n';
+ (*target)[AddLen + 2] = '\0';
+}
+
+void AddPortError(char *Port, char *ErrorMessage)
+{
+ DetailErrorFlags |= ERR_PORT;
+
+ AppendString(&errormessages, ErrorMessage, &nSizErrmsg, 10);
+ AppendString(&portlist, Port, &nSizPort, 2);
+}
+
+
void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc)
{
struct ProtoFunctionHook *p;
void initialize_server_extensions(void)
{
+ long filter;
+
lprintf(CTDL_INFO, "%s\n", serv_bio_init());
lprintf(CTDL_INFO, "%s\n", serv_calendar_init());
lprintf(CTDL_INFO, "%s\n", serv_notes_init());
lprintf(CTDL_INFO, "%s\n", serv_network_init());
lprintf(CTDL_INFO, "%s\n", serv_newuser_init());
lprintf(CTDL_INFO, "%s\n", serv_pas2_init());
+ lprintf(CTDL_INFO, "%s\n", serv_smtp_init());
lprintf(CTDL_INFO, "%s\n", serv_pop3_init());
lprintf(CTDL_INFO, "%s\n", serv_rwho_init());
- lprintf(CTDL_INFO, "%s\n", serv_smtp_init());
lprintf(CTDL_INFO, "%s\n", serv_spam_init());
/* lprintf(CTDL_INFO, "%s\n", serv_test_init()); */
lprintf(CTDL_INFO, "%s\n", serv_vandelay_init());
lprintf(CTDL_INFO, "%s\n", serv_postfix_tcpdict());
lprintf(CTDL_INFO, "%s\n", serv_sieve_init());
lprintf(CTDL_INFO, "%s\n", serv_managesieve_init());
+
+ for (filter = 1; filter != 0; filter = filter << 1)
+ if ((filter & DetailErrorFlags) != 0)
+ LogPrintMessages(filter);
}
)
{
struct ServiceFunctionHook *newfcn;
- char message[SIZ];
+ char *message;
+ char *error;
newfcn = (struct ServiceFunctionHook *)
malloc(sizeof(struct ServiceFunctionHook));
+ message = (char*) malloc (SIZ);
+
newfcn->next = ServiceHookTable;
newfcn->tcp_port = tcp_port;
newfcn->sockpath = sockpath;
newfcn->h_async_function = h_async_function;
if (sockpath != NULL) {
- newfcn->msock = ig_uds_server(sockpath, config.c_maxsessions);
- snprintf(message, sizeof message, "Unix domain socket '%s': ", sockpath);
+ newfcn->msock = ig_uds_server(sockpath, config.c_maxsessions, &error);
+ snprintf(message, SIZ, "Unix domain socket '%s': ", sockpath);
}
else if (tcp_port <= 0) { /* port -1 to disable */
lprintf(CTDL_INFO, "Service has been manually disabled, skipping\n");
}
else {
newfcn->msock = ig_tcp_server(config.c_ip_addr,
- tcp_port,
- config.c_maxsessions);
- snprintf(message, sizeof message, "TCP port %d: ", tcp_port);
+ tcp_port,
+ config.c_maxsessions,
+ &error);
+ snprintf(message, SIZ, "TCP port %d: ", tcp_port);
}
if (newfcn->msock > 0) {
lprintf(CTDL_INFO, "%s\n", message);
}
else {
+ AddPortError(message, error);
strcat(message, "FAILED.");
lprintf(CTDL_CRIT, "%s\n", message);
+ free(error);
free(newfcn);
}
+ free(message);
}
/* if TLS is already there, should we say that again? */
"\"STARTTLS\"\r\n"
#endif
- "\"SIEVE\" \"FILEINTO VACATION\"\r\n" /* TODO: print sieve extensions here. */
- "OK\r\n");
+ "\"SIEVE\" \"%s\"\r\n"
+ "OK\r\n", msiv_extensions);
}
/* AUTHENTICATE command; 2.1 */
void cmd_mgsve_auth(int num_parms, char **parms, struct sdm_userdata *u)
{
-/* TODO: compare "digest-md5" or "gssapi" and answer with "NO" */
if ((num_parms == 3) && !strncasecmp(parms[1], "PLAIN", 5))
/* todo, check length*/
{
char auth[SIZ];
int retval;
-
- /* todo: how to do plain auth? */
char *message = ReadString(GetSizeToken(parms[2]), parms[0]);
- if (message != NULL) {/* do we have tokenized login? */
+ if (message != NULL) {/**< do we have tokenized login? */
retval = CtdlDecodeBase64(auth, MGSVE->transmitted_message, SIZ);
}
else
}
}
- cprintf("NO\r\n");/* we just support auth plain. */
+ cprintf("NO \"Authentication Failure.\"\r\n");/* we just support auth plain. */
CC->kill_me = 1;
}
#ifdef HAVE_OPENSSL
-/* STARTTLS command chapter 2.2 */
+/**
+ * STARTTLS command chapter 2.2
+ */
void cmd_mgsve_starttls(void)
-{ /* answer with OK, and fire off tls session. */
+{ /** answer with OK, and fire off tls session. */
cprintf("OK\r\n");
CtdlStartTLS(NULL, NULL, NULL);
cmd_mgsve_caps();
-/* LOGOUT command, see chapter 2.3 */
+/**
+ *LOGOUT command, see chapter 2.3
+ */
void cmd_mgsve_logout(struct sdm_userdata *u)
-{/* send "OK" and terminate the connection. */
+{
cprintf("OK\r\n");
lprintf(CTDL_NOTICE, "MgSve bye.");
CC->kill_me = 1;
}
-/* HAVESPACE command. see chapter 2.5 */
+/**
+ * HAVESPACE command. see chapter 2.5
+ */
void cmd_mgsve_havespace(void)
{
-/* TODO answer NO in any case if auth is missing. */
/* as we don't have quotas in citadel we should always answer with OK;
* pherhaps we should have a max-scriptsize.
*/
}
}
-/* PUTSCRIPT command, see chapter 2.6 */
+/**
+ * PUTSCRIPT command, see chapter 2.6
+ */
void cmd_mgsve_putscript(int num_parms, char **parms, struct sdm_userdata *u)
{
/* "scriptname" {nnn+} */
-/* TODO: answer with "NO" instant, if we're unauthorized. */
/* AFTER we have the whole script overwrite existing scripts */
/* spellcheck the script before overwrite old ones, and reply with "no" */
if (num_parms == 3)
-/* LISTSCRIPT command. see chapter 2.7 */
+/**
+ * LISTSCRIPT command. see chapter 2.7
+ */
void cmd_mgsve_listscript(int num_parms, char **parms, struct sdm_userdata *u)
{
nScripts++;
}
}
-
- // if (nScripts > 0)
- cprintf("OK\r\n");
- // else
- //cprintf("NO \"No scripts found.\"\r\n");
+ cprintf("OK\r\n");
}
-/* SETACTIVE command. see chapter 2.8 */
+/**
+ * \brief SETACTIVE command. see chapter 2.8
+ */
void cmd_mgsve_setactive(int num_parms, char **parms, struct sdm_userdata *u)
{
-/* TODO: check auth, if not, answer with "no" */
-/* search our room for subjects with that scriptname,
- * if the scriptname is empty, use the default flag.
- * if the script is not there answer "No "there is no script by that name "
- */
if (num_parms == 2)
{
if (msiv_setactive(u, parms[1]) == 0) {
}
-/* GETSCRIPT command. see chapter 2.9 */
+/**
+ * \brief GETSCRIPT command. see chapter 2.9
+ */
void cmd_mgsve_getscript(int num_parms, char **parms, struct sdm_userdata *u)
{
-/* check first param, this is the name. look up that in the folder.
- * answer with the size {nnn+}and spill it out, one blank line and OK
- */
-
if (num_parms == 2){
char *script_content;
long slen;
}
-/* DELETESCRIPT command. see chapter 2.10 */
+/**
+ * \brief DELETESCRIPT command. see chapter 2.10
+ */
void cmd_mgsve_deletescript(int num_parms, char **parms, struct sdm_userdata *u)
{
-/* TODO: check auth, if not, answer with "no" */
int i=-1;
if (num_parms == 2)
}
-
-/*
- *
-void mgsve_get_user(char *argbuf) {
- char buf[SIZ];
- char username[SIZ];
-
- CtdlDecodeBase64(username, argbuf, SIZ);
- / * lprintf(CTDL_DEBUG, "Trying <%s>\n", username); * /
- if (CtdlLoginExistingUser(username) == login_ok) {
- CtdlEncodeBase64(buf, "Password:", 9);
- cprintf("334 %s\r\n", buf);
- MGSVE->command_state = mgsve_password;
- }
- else {
- cprintf("500 5.7.0 No such user.\r\n");
- MGSVE->command_state = mgsve_command;
- }
-}
- */
-
-
-/*
- *
-void mgsve_get_pass(char *argbuf) {
- char password[SIZ];
-
- CtdlDecodeBase64(password, argbuf, SIZ);
- / * lprintf(CTDL_DEBUG, "Trying <%s>\n", password); * /
- if (CtdlTryPassword(password) == pass_ok) {
- mgsve_auth_greeting();
- }
- else {
- cprintf("535 5.7.0 Authentication failed.\r\n");
- }
- MGSVE->command_state = mgsve_command;
-}
- */
-
-
-/*
- * Back end for PLAIN auth method (either inline or multistate)
- */
-void mgsve_try_plain(char *encoded_authstring) {
- char decoded_authstring[1024];
- char ident[256];
- char user[256];
- char pass[256];
-
- CtdlDecodeBase64(decoded_authstring,
- encoded_authstring,
- strlen(encoded_authstring) );
- safestrncpy(ident, decoded_authstring, sizeof ident);
- safestrncpy(user, &decoded_authstring[strlen(ident) + 1], sizeof user);
- safestrncpy(pass, &decoded_authstring[strlen(ident) + strlen(user) + 2], sizeof pass);
-
-// MGSVE->command_state = mgsve_command;
-/*
- if (CtdlLoginExistingUser(user) == login_ok) {
- if (CtdlTryPassword(pass) == pass_ok) {
- mgsve_auth_greeting();
- return;
- }
- }
-*/
- cprintf("504 5.7.4 Authentication failed.\r\n");
-}
-
-
-/*
- * Attempt to perform authenticated managesieve
+/**
+ * \brief Attempt to perform authenticated managesieve
*/
void mgsve_auth(char *argbuf) {
char username_prompt[64];
char encoded_authstring[1024];
if (CC->logged_in) {
- cprintf("504 5.7.4 Already logged in.\r\n");
+ cprintf("NO \"Already logged in.\"\r\n");
return;
}
if (!strncasecmp(method, "login", 5) ) {
if (strlen(argbuf) >= 7) {
-// mgsve_get_user(&argbuf[6]);
}
else {
CtdlEncodeBase64(username_prompt, "Username:", 9);
cprintf("334 %s\r\n", username_prompt);
-// MGSVE->command_state = mgsve_user;
}
return;
}
if (!strncasecmp(method, "plain", 5) ) {
if (num_tokens(argbuf, ' ') < 2) {
cprintf("334 \r\n");
-// MGSVE->command_state = mgsve_plain;
return;
}
-
extract_token(encoded_authstring, argbuf, 1, ' ', sizeof encoded_authstring);
-
-/// mgsve_try_plain(encoded_authstring);
return;
}
if (strncasecmp(method, "login", 5) ) {
- cprintf("504 5.7.4 Unknown authentication method.\r\n");
+ cprintf("NO \"Unknown authentication method.\"\r\n");
return;
}
length = client_getln(cmdbuf, sizeof cmdbuf);
if (length >= 1) {
num_parms = imap_parameterize(parms, cmdbuf);
- /// length = client_getln(parms[0], sizeof parms[0]);
if (num_parms == 0) return;
length = strlen(parms[0]);
}
return;
}
lprintf(CTDL_INFO, "MANAGESIEVE: %s\n", cmdbuf);
-//// we have different lengths while (strlen(cmdbuf) < 5) strcat(cmdbuf, " ");
if ((length>= 12) && (!strncasecmp(parms[0], "AUTHENTICATE", 12))){
cmd_mgsve_auth(num_parms, parms, &u);
}
}
else if ((length>= 6) && (!strncasecmp(parms[0], "CAPABILITY", 10))){
cmd_mgsve_caps();
- } /* these commands need to be authenticated. throw it out if it tries. */
+ }
+ /** these commands need to be authenticated. throw it out if it tries. */
else if (!CtdlAccessCheck(ac_logged_in))
{
msiv_load(&u);
msiv_store(&u, changes_made);
}
else {
- /// todo: log this.
cprintf("No\r\n");
+ lprintf(CTDL_INFO, "illegal Managesieve command: %s", parms[0]);
CC->kill_me = 1;
}
lprintf(CTDL_INFO, "sending 500 REJECT noone here by that name: %s\n", internet_addr);
}
+ if (rcpt != NULL) free (rcpt);
}
/// CC->kill_me = 1;
}
if (config.c_pop3s_port == 0) config.c_pop3s_port = 995;
if (config.c_imaps_port == 0) config.c_imaps_port = 993;
if (config.c_pftcpdict_port == 0) config.c_pftcpdict_port = -1;
- if (config.c_managesieve_port == 0) config.c_managesieve_port = -1;
+ if (config.c_managesieve_port == 0) config.c_managesieve_port = 2020;
/* Go through a series of dialogs prompting for config info */
if (setup_type != UI_SILENT) {
* a TCP port. The server shuts down if the bind fails.
*
*/
-int ig_tcp_server(char *ip_addr, int port_number, int queue_len)
+int ig_tcp_server(char *ip_addr, int port_number, int queue_len, char **errormessage)
{
struct sockaddr_in sin;
int s, i;
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s < 0) {
- lprintf(CTDL_EMERG, "citserver: Can't create a socket: %s\n",
- strerror(errno));
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ,
+ "citserver: Can't create a socket: %s",
+ strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
return(-1);
}
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i));
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
- lprintf(CTDL_EMERG, "citserver: Can't bind: %s\n",
- strerror(errno));
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ,
+ "citserver: Can't bind: %s",
+ strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
close(s);
return(-1);
}
/* set to nonblock - we need this for some obscure situations */
if (fcntl(s, F_SETFL, O_NONBLOCK) < 0) {
- lprintf(CTDL_EMERG,
- "citserver: Can't set socket to non-blocking: %s\n",
- strerror(errno));
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ,
+ "citserver: Can't set socket to non-blocking: %s",
+ strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
close(s);
return(-1);
}
if (listen(s, actual_queue_len) < 0) {
- lprintf(CTDL_EMERG, "citserver: Can't listen: %s\n",
- strerror(errno));
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ,
+ "citserver: Can't listen: %s",
+ strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
close(s);
return(-1);
}
/*
* Create a Unix domain socket and listen on it
*/
-int ig_uds_server(char *sockpath, int queue_len)
+int ig_uds_server(char *sockpath, int queue_len, char **errormessage)
{
struct sockaddr_un addr;
int s;
i = unlink(sockpath);
if (i != 0) if (errno != ENOENT) {
- lprintf(CTDL_EMERG, "citserver: can't unlink %s: %s\n",
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ, "citserver: can't unlink %s: %s",
sockpath, strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
return(-1);
}
s = socket(AF_UNIX, SOCK_STREAM, 0);
if (s < 0) {
- lprintf(CTDL_EMERG, "citserver: Can't create a socket: %s\n",
- strerror(errno));
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ,
+ "citserver: Can't create a socket: %s",
+ strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
return(-1);
}
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- lprintf(CTDL_EMERG, "citserver: Can't bind: %s\n",
- strerror(errno));
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ,
+ "citserver: Can't bind: %s",
+ strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
return(-1);
}
/* set to nonblock - we need this for some obscure situations */
if (fcntl(s, F_SETFL, O_NONBLOCK) < 0) {
- lprintf(CTDL_EMERG,
- "citserver: Can't set socket to non-blocking: %s\n",
- strerror(errno));
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ,
+ "citserver: Can't set socket to non-blocking: %s",
+ strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
close(s);
return(-1);
}
if (listen(s, actual_queue_len) < 0) {
- lprintf(CTDL_EMERG, "citserver: Can't listen: %s\n",
- strerror(errno));
+ *errormessage = (char*) malloc(SIZ + 1);
+ snprintf(*errormessage, SIZ,
+ "citserver: Can't listen: %s",
+ strerror(errno));
+ lprintf(CTDL_EMERG, "%s\n", *errormessage);
return(-1);
}
void init_sysdep (void);
void begin_critical_section (int which_one);
void end_critical_section (int which_one);
-int ig_tcp_server (char *ip_addr, int port_number, int queue_len);
-int ig_uds_server(char *sockpath, int queue_len);
+int ig_tcp_server (char *ip_addr, int port_number, int queue_len,char **errormessage);
+int ig_uds_server(char *sockpath, int queue_len, char **errormessage);
struct CitContext *MyContext (void);
struct CitContext *CreateNewContext (void);
void InitMyContext (struct CitContext *con);
((op == 1) ? "invited to" : "kicked out of"),
CC->room.QRname,
CC->user.fullname);
- aide_message(bbb);
+ aide_message(bbb,"User Admin Message");
return(0);
}
if (deleted) {
sprintf(notify, "User \"%s\" has been deleted by %s.\n",
usbuf.fullname, CC->user.fullname);
- aide_message(notify);
+ aide_message(notify, "User Deletion Message");
}
cprintf("%d Ok", CIT_OK);