[1447] in Moira
Re: Finalized Patches for Moira Support for Pismere
daemon@ATHENA.MIT.EDU (Robert A Basch)
Tue Mar 14 20:00:45 2000
Message-Id: <200003150100.UAA216344@aupair.mit.edu>
To: Danilo D Almeida <dalmeida@MIT.EDU>
cc: moiradev@MIT.EDU
In-Reply-To: Your message of "Thu, 02 Mar 2000 21:12:59 EST."
<200003030212.VAA28074@fides.mit.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Tue, 14 Mar 2000 20:00:37 -0500
From: Robert A Basch <rbasch@MIT.EDU>
I've reviewed the patch, and made the following modifications to it:
* I added autoconf tests for features such as unistd.h, getopt.h, POSIX
signals, and uname(), and used the corresponding #ifdef's instead of
#ifdef _WIN32.
I left the network-related includes, e.g. netdb.h, under #ifndef _WIN32;
these should get put into a single header file eventually, but I'll leave
that for another day.
I also did not add a test for strtok_r(); the Windows strtok() is
apparently reentrant, so can just be substituted. (On Solaris, the
use of strtok_r() generates a warning, even though string.h is
included. I'll sort this out some other time).
* I fixed up some whitespace problems with the patch as submitted, which
had caused patch to get confused.
* I removed a couple of gratuitous blank lines added.
* In mailmaint.c, in display_buff():
> ! for (i = 0; i <= (int)strlen(buf); i++)
I added a len variable, as was done elsewhere, both to avoid the cast
and so strlen() isn't done in the loop test.
* In clients/moira/menu.c: in get_tmp_dir():
+ len = GetTempPath(sizeof(tmp), tmp);
+ if (!len || (len > sizeof(tmp)))
+ strcat(tmp, ".");
I changed the strcat to strcpy.
* In mrtest.c, I used the new HAVE_POSIX_SIGNALS #ifdef for the signal
blocking functions, but the non-POSIX version has some Win32-specific
code, under #ifdef _WIN32. So it will fail to build on a non-POSIX,
non-Win32 platform until that case is added.
* In util/et/error_message.c, I repaired a change to the rcsid string,
and removed an apparently unnecessarily added include of com_err.h,
so the file is no longer modified.
Because of the whitespace problems with the original patch, I am enclosing
the updated patch in its entirety (excluding the regeneration of configure).
I will check this in tomorrow unless someone complains.
Bob
Index: configure.in
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/configure.in,v
retrieving revision 1.23
diff -c -r1.23 configure.in
*** configure.in 2000/02/10 05:36:13 1.23
--- configure.in 2000/03/14 22:47:52
***************
*** 352,358 ****
AC_SUBST(CURSES_SUBDIRS)
! AC_CHECK_FUNCS(getusershell strlcpy strlcat)
MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
MR_INCLUDE('$(SRCTOP)/include')
--- 352,362 ----
AC_SUBST(CURSES_SUBDIRS)
! AC_CHECK_FUNCS(getusershell strlcpy strlcat uname)
!
! AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_POSIX_SIGNALS))
!
! AC_CHECK_HEADERS(unistd.h getopt.h)
MR_EXTEND(PRO_C_INCLUDES, INCLUDE='$(srcdir)')
MR_INCLUDE('$(SRCTOP)/include')
Index: clients/addusr/addusr.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/addusr/addusr.c,v
retrieving revision 1.15
diff -c -r1.15 addusr.c
*** addusr.c 1999/12/30 17:30:27 1.15
--- addusr.c 2000/03/13 23:45:19
***************
*** 46,52 ****
int status, lineno;
char **arg = argv, *qargv[U_END];
char *p, *first, *middle, *last, *id, *login, *server;
! char buf[BUFSIZ], idbuf[32];
FILE *input;
/* clear all flags & lists */
--- 46,52 ----
int status, lineno;
char **arg = argv, *qargv[U_END];
char *p, *first, *middle, *last, *id, *login, *server;
! char buf[BUFSIZ];
FILE *input;
/* clear all flags & lists */
Index: clients/blanche/blanche.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/blanche/blanche.c,v
retrieving revision 1.44
diff -c -r1.44 blanche.c
*** blanche.c 2000/01/07 21:14:12 1.44
--- blanche.c 2000/03/13 23:45:19
***************
*** 826,864 ****
void usage(char **argv)
{
fprintf(stderr, "Usage: %s listname [options]\n", argv[0]);
fprintf(stderr, "Options are\n");
! fprintf(stderr, " %-39s%-39s\n", "-v | -verbose",
"-C | -create");
! fprintf(stderr, " %-39s%-39s\n", "-m | -members",
"-R | -rename newname");
! fprintf(stderr, " %-39s%-39s\n", "-u | -users",
"-P | -public");
! fprintf(stderr, " %-39s%-39s\n", "-l | -lists",
"-NP | -private");
! fprintf(stderr, " %-39s%-39s\n", "-s | -strings",
"-A | -active");
! fprintf(stderr, " %-39s%-39s\n", "-k | -kerberos",
"-I | -inactive");
! fprintf(stderr, " %-39s%-39s\n", "-i | -info",
"-V | -visible");
! fprintf(stderr, " %-39s%-39s\n", "-r | -recursive",
"-H | -hidden");
! fprintf(stderr, " %-39s%-39s\n", "-a | -add member",
"-M | -mail");
! fprintf(stderr, " %-39s%-39s\n", "-d | -delete member",
"-NM | -notmail");
! fprintf(stderr, " %-39s%-39s\n", "-al | -addlist filename",
"-G | -group");
! fprintf(stderr, " %-39s%-39s\n", "-dl | -deletelist filename",
"-NG | -notgroup");
! fprintf(stderr, " %-39s%-39s\n", "-f | -file filename",
"-D | -desc description");
! fprintf(stderr, " %-39s%-39s\n", "-at | -addtagged member tag",
"-O | -owner owner");
! fprintf(stderr, " %-39s%-39s\n", "-ct | -changetag member tag",
"-t | -tags");
! fprintf(stderr, " %-39s%-39s\n", "-n | -noauth",
"-db | -database host[:port]");
exit(1);
}
--- 826,865 ----
void usage(char **argv)
{
+ #define USAGE_OPTIONS_FORMAT " %-39s%s\n"
fprintf(stderr, "Usage: %s listname [options]\n", argv[0]);
fprintf(stderr, "Options are\n");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-v | -verbose",
"-C | -create");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-m | -members",
"-R | -rename newname");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-u | -users",
"-P | -public");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-l | -lists",
"-NP | -private");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-s | -strings",
"-A | -active");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-k | -kerberos",
"-I | -inactive");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-i | -info",
"-V | -visible");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-r | -recursive",
"-H | -hidden");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-a | -add member",
"-M | -mail");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-d | -delete member",
"-NM | -notmail");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-al | -addlist filename",
"-G | -group");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-dl | -deletelist filename",
"-NG | -notgroup");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-f | -file filename",
"-D | -desc description");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-at | -addtagged member tag",
"-O | -owner owner");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-ct | -changetag member tag",
"-t | -tags");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-n | -noauth",
"-db | -database host[:port]");
exit(1);
}
***************
*** 869,875 ****
void show_list_member(struct member *memberstruct)
{
char *s = "";
- char *tag;
switch (memberstruct->type)
{
--- 870,875 ----
Index: clients/lib/pobox.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/lib/pobox.c,v
retrieving revision 1.3
diff -c -r1.3 pobox.c
*** pobox.c 2000/02/22 17:45:50 1.3
--- pobox.c 2000/03/13 23:45:19
***************
*** 26,31 ****
--- 26,35 ----
extern char *whoami;
+ #ifdef _WIN32
+ #define strtok_r(s, tokens, resume) strtok(s, tokens)
+ #endif /* _WIN32 */
+
int mrcl_validate_pobox_smtp(char *user, char *address, char **ret)
{
char *addr, *retaddr, *p, *lasts = NULL;
Index: clients/mailmaint/mailmaint.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/mailmaint/mailmaint.c,v
retrieving revision 1.45
diff -c -r1.45 mailmaint.c
*** mailmaint.c 1999/12/30 17:30:34 1.45
--- mailmaint.c 2000/03/15 00:10:01
***************
*** 16,31 ****
#include <ctype.h>
#ifdef HAVE_CURSES
#include <curses.h>
#endif
- #include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <krb.h>
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/mailmaint/mailmaint.c,v 1.45 1999/12/30 17:30:34 danw Exp $");
#define STARTCOL 0
--- 16,59 ----
#include <ctype.h>
#ifdef HAVE_CURSES
+ #ifdef _WIN32
+ #include <conio.h>
+ #ifdef MOUSE_MOVED
+ #undef MOUSE_MOVED
+ #endif
+ #endif /*_WIN32*/
#include <curses.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifdef HAVE_UNISTD_H
#include <unistd.h>
+ #endif
#include <krb.h>
+ #ifdef _WIN32
+ #define INPUT_MASK 0xff
+ #ifdef getchar
+ #undef getchar
+ #endif
+ #define getchar() _getch()
+ #ifdef title
+ #undef title
+ #endif
+ static void DELETE_A_CHAR(void)
+ {
+ int x, y;
+ getsyx(&y, &x);
+ x -= 1;
+ mvdelch(y,x);
+ }
+ #else /* !_WIN32 */
+ #define INPUT_MASK 0x7f
+ #define DELETE_A_CHAR() printf("\b \b");
+ #endif /* !_WIN32 */
+
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/mailmaint/mailmaint.c,v 1.45 1999/12/30 17:30:34 danw Exp $");
#define STARTCOL 0
***************
*** 90,95 ****
--- 118,124 ----
void display_menu(MENU *menu);
void pack_main_menu(void);
void pack_help_menu(void);
+ void free_menu(MENU* menu);
void highlight(MENU *menu);
void title(char *buff);
void center_text(int row, char *buff);
***************
*** 159,169 ****
--- 188,200 ----
display_buff("to at least 24 lines and 60 columns.\n");
exit(0);
}
+
raw();
noecho();
old_hook = set_com_err_hook(menu_err_hook);
position[0] = oldpos[0] = 1;
level = 0;
+
pack_main_menu();
pack_help_menu();
display_menu(main_menu);
***************
*** 171,176 ****
--- 202,227 ----
cls();
endwin();
set_com_err_hook(old_hook);
+
+ free_menu(main_menu);
+ free_menu(help_menu);
+
+ if (current_li->acl_type)
+ free(current_li->acl_type);
+ if (current_li->acl_name)
+ free(current_li->acl_name);
+ if (current_li->desc)
+ free(current_li->desc);
+ if (current_li->modtime)
+ free(current_li->modtime);
+ if (current_li->modby)
+ free(current_li->modby);
+ if (current_li->modwith)
+ free(current_li->modwith);
+ free(current_li);
+
+ mr_disconnect();
+
exit(0);
punt:
***************
*** 191,197 ****
currow = DISPROW + 2;
page = 1;
toggle = num_members = moreflg = 0;
! c = getchar() & 0x7f; /* mask parity bit */
if (c == '\r' || c == '\n')
{
if (position[level] == 7)
--- 242,248 ----
currow = DISPROW + 2;
page = 1;
toggle = num_members = moreflg = 0;
! c = getchar() & INPUT_MASK; /* mask parity bit */
if (c == '\r' || c == '\n')
{
if (position[level] == 7)
***************
*** 245,255 ****
if (retflg)
delete_member();
break;
case 27: /* escape */
! c = getchar() & 0x7f;
if (c == 91)
{
! c = getchar() & 0x7f;
if (c == 65) /* up arrow */
{
position[level]--;
--- 296,307 ----
if (retflg)
delete_member();
break;
+ #ifndef _WIN32
case 27: /* escape */
! c = getchar() & INPUT_MASK;
if (c == 91)
{
! c = getchar() & INPUT_MASK;
if (c == 65) /* up arrow */
{
position[level]--;
***************
*** 266,271 ****
--- 318,342 ----
}
}
}
+ #else /* _WIN32 */
+ case 0xe0:
+ c = getchar() & INPUT_MASK;
+ if (c == 0x48) /* up arrow */
+ {
+ position[level]--;
+ if (!position[level])
+ position[level] = 7;
+ }
+ else
+ {
+ if (c == 0x50) /* down arrow */
+ {
+ position[level]++;
+ if (position[level] > 7)
+ position[level] = 1;
+ }
+ }
+ #endif /* _WIN32 */
break;
default:
printf("%c", 7);
***************
*** 311,316 ****
--- 382,388 ----
show_text(currow, STARTCOL, "Press any Key to continue...");
getchar();
}
+ free(buf);
clrwin(DISPROW);
}
***************
*** 318,331 ****
void display_buff(char *buf)
{
int i, cnt;
! char *printbuf;
int maxcol;
maxcol = COLS;
cnt = 0;
printbuf = calloc(maxcol, 1);
! for (i = 0; i <= strlen(buf); i++)
{
printbuf[cnt] = buf[i];
cnt++;
--- 390,405 ----
void display_buff(char *buf)
{
int i, cnt;
! char *printbuf = NULL;
int maxcol;
+ int len;
maxcol = COLS;
cnt = 0;
printbuf = calloc(maxcol, 1);
! len = strlen(buf);
! for (i = 0; i <= len; i++)
{
printbuf[cnt] = buf[i];
cnt++;
***************
*** 337,347 ****
printbuf = calloc(maxcol, 1);
}
}
! if (strlen(buf) % maxcol != 0)
{
start_display_buff(printbuf);
- free(printbuf);
}
return;
}
--- 411,422 ----
printbuf = calloc(maxcol, 1);
}
}
! if (len % maxcol != 0)
{
start_display_buff(printbuf);
}
+ if (printbuf)
+ free(printbuf);
return;
}
***************
*** 404,409 ****
--- 479,485 ----
show_text(DISPROW + 4, STARTCOL, "Press any Key to continue...");
getchar();
}
+ free(buf);
clrwin(DISPROW);
}
***************
*** 434,440 ****
--- 510,520 ----
currow = DISPROW + 4;
show_text(DISPROW + 4, STARTCOL, "Press any Key to continue...");
getchar();
+ free(argv[0]);
+ free(argv[1]);
+ free(argv[2]);
}
+ free(buf);
clrwin(DISPROW);
}
***************
*** 460,465 ****
--- 540,546 ----
show_text(currow, STARTCOL, "Press any Key to continue...");
getchar();
clrwin(DISPROW);
+ free(buf);
}
/****************************************************/
***************
*** 468,474 ****
char c;
show_text(DISPROW, STARTCOL, "This function may take a while... proceed? [n] ");
! c = getchar() & 0x7f;
if (c == 'y' || c == 'Y')
{
move(DISPROW + 1, STARTCOL);
--- 549,555 ----
char c;
show_text(DISPROW, STARTCOL, "This function may take a while... proceed? [n] ");
! c = getchar() & INPUT_MASK;
if (c == 'y' || c == 'Y')
{
move(DISPROW + 1, STARTCOL);
***************
*** 557,568 ****
show_text(currow, STARTCOL, "Press any key to continue...");
getchar();
clrwin(DISPROW);
! return;
}
end_display();
! return;
}
clrwin(DISPROW);
}
/****************************************************/
--- 638,651 ----
show_text(currow, STARTCOL, "Press any key to continue...");
getchar();
clrwin(DISPROW);
! goto cleanup;
}
end_display();
! goto cleanup;
}
clrwin(DISPROW);
+ cleanup:
+ free(buf);
}
/****************************************************/
***************
*** 598,604 ****
erase_line(currow, STARTCOL);
show_text(currow, STARTCOL, "Flushing query...");
moreflg = 1;
! return;
}
clrwin(DISPROW + 2);
currow = DISPROW + 2;
--- 681,687 ----
erase_line(currow, STARTCOL);
show_text(currow, STARTCOL, "Flushing query...");
moreflg = 1;
! goto cleanup;
}
clrwin(DISPROW + 2);
currow = DISPROW + 2;
***************
*** 616,621 ****
--- 699,706 ----
currow++;
}
toggle = !toggle;
+ cleanup:
+ free(buffer);
}
/****************************************************/
***************
*** 637,642 ****
--- 722,728 ----
show_text(currow, STARTCOL, "Press any key to continue...");
getchar();
clrwin(DISPROW);
+ free(buffer);
}
/****************************************************/
***************
*** 692,697 ****
--- 778,784 ----
main_menu->items[4] = strdup("5. Add yourself to a mailing list.");
main_menu->items[5] = strdup("6. Delete yourself from a mailing list.");
main_menu->items[6] = strdup("q. Quit.");
+ free(buf);
}
/****************************************************/
***************
*** 710,715 ****
--- 797,813 ----
}
/****************************************************/
+ void free_menu(MENU* menu)
+ {
+ int i;
+ for (i = 0; i < menu->num_items; i++)
+ free(menu->items[i]);
+ free(menu->items);
+ free(menu->title);
+ free(menu);
+ }
+
+ /****************************************************/
void highlight(MENU *menu)
{
if (oldpos[level] != position[level])
***************
*** 843,852 ****
addstr(prompt);
refresh();
for (p = buf; abs(strlen(p) - strlen(buf)) <= buflen;)
{
refresh();
! c = getchar() & 0x7f;
switch (c)
{
case CTL('C'):
--- 941,951 ----
addstr(prompt);
refresh();
+
for (p = buf; abs(strlen(p) - strlen(buf)) <= buflen;)
{
refresh();
! c = getchar() & INPUT_MASK;
switch (c)
{
case CTL('C'):
***************
*** 871,886 ****
if (p > buf)
{
p--;
! printf("\b \b");
}
break;
case CTL('U'):
case CTL('G'):
case CTL('['):
while (p-- > buf)
! printf("\b \b");
p = buf;
break;
default:
if (abs(strlen(p) - strlen(buf)) >= buflen)
{
--- 970,991 ----
if (p > buf)
{
p--;
! DELETE_A_CHAR();
}
break;
case CTL('U'):
case CTL('G'):
case CTL('['):
while (p-- > buf)
! DELETE_A_CHAR();
p = buf;
break;
+ #ifdef _WIN32
+ case 0xe0:
+ c = getchar() & INPUT_MASK;
+ putchar(CTL('G'));
+ break;
+ #endif /*_WIN32*/
default:
if (abs(strlen(p) - strlen(buf)) >= buflen)
{
Index: clients/moira/acl.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/acl.c,v
retrieving revision 1.1
diff -c -r1.1 acl.c
*** acl.c 2000/01/07 21:14:04 1.1
--- acl.c 2000/03/13 23:45:20
***************
*** 79,85 ****
{
static char name[BUFSIZ];
char buf[BUFSIZ];
- int status;
if (!info) /* If no informaion */
{
--- 79,84 ----
***************
*** 109,117 ****
static char **AskACLInfo(char **info)
{
char temp_buf[BUFSIZ];
- char *args[3];
- char *s, *d;
- int status;
Put_message("");
info[ACL_HOST] = canonicalize_hostname(info[ACL_HOST]);
--- 108,113 ----
***************
*** 191,197 ****
int AddACL(int argc, char **argv)
{
! char *info[MAX_ARGS_SIZE], **args, *host;
int stat;
argv[1] = canonicalize_hostname(strdup(argv[1]));
--- 187,193 ----
int AddACL(int argc, char **argv)
{
! char *info[MAX_ARGS_SIZE], **args;
int stat;
argv[1] = canonicalize_hostname(strdup(argv[1]));
Index: clients/moira/attach.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/attach.c,v
retrieving revision 1.48
diff -c -r1.48 attach.c
*** attach.c 1999/04/30 17:41:06 1.48
--- attach.c 2000/03/14 17:50:50
***************
*** 28,34 ****
--- 28,36 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifdef HAVE_UNISTD_H
#include <unistd.h>
+ #endif /* HAVE_UNISTD_H */
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/attach.c,v 1.48 1999/04/30 17:41:06 danw Exp $");
***************
*** 234,242 ****
return info[FS_NAME];
}
-
char *canonicalize_cell(char *c)
{
struct stat stbuf;
char path[512];
int count;
--- 236,246 ----
return info[FS_NAME];
}
char *canonicalize_cell(char *c)
{
+ #ifdef _WIN32
+ return c;
+ #else /* !_WIN32 */
struct stat stbuf;
char path[512];
int count;
***************
*** 250,255 ****
--- 254,260 ----
path[count] = 0;
free(c);
return strdup(path);
+ #endif /* _WIN32 */
}
Index: clients/moira/cluster.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/cluster.c,v
retrieving revision 1.38
diff -c -r1.38 cluster.c
*** cluster.c 1999/04/30 17:41:07 1.38
--- cluster.c 2000/03/14 21:52:27
***************
*** 23,33 ****
--- 23,38 ----
#include "globals.h"
#include <sys/types.h>
+
+ #ifdef HAVE_UNAME
#include <sys/utsname.h>
+ #endif
+ #ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+ #endif /* _WIN32 */
#include <ctype.h>
#include <stdio.h>
***************
*** 584,590 ****
return NULL;
if (GetAddressFromUser("Network mask", &info[SN_MASK]) == SUB_ERROR)
return NULL;
! if (atoi(info[SN_LOW]) == ntohl(inet_addr(S_DEFAULT_LOW)))
{
struct in_addr low;
unsigned long mask, addr;
--- 589,595 ----
return NULL;
if (GetAddressFromUser("Network mask", &info[SN_MASK]) == SUB_ERROR)
return NULL;
! if (atoi(info[SN_LOW]) == (int)ntohl(inet_addr(S_DEFAULT_LOW)))
{
struct in_addr low;
unsigned long mask, addr;
***************
*** 600,606 ****
if (GetAddressFromUser("Lowest assignable address", &info[SN_LOW]) ==
SUB_ERROR)
return NULL;
! if (atoi(info[SN_HIGH]) == ntohl(inet_addr(S_DEFAULT_HIGH)))
{
struct in_addr high;
unsigned long mask, addr;
--- 605,611 ----
if (GetAddressFromUser("Lowest assignable address", &info[SN_LOW]) ==
SUB_ERROR)
return NULL;
! if (atoi(info[SN_HIGH]) == (int)ntohl(inet_addr(S_DEFAULT_HIGH)))
{
struct in_addr high;
unsigned long mask, addr;
***************
*** 997,1006 ****
else
{
struct hostent *hp;
struct utsname name;
-
uname(&name);
hp = gethostbyname(name.nodename);
cp = strchr(hp->h_name, '.');
if (cp)
def_domain = strdup(++cp);
--- 1002,1017 ----
else
{
struct hostent *hp;
+ #ifdef HAVE_UNAME
struct utsname name;
uname(&name);
hp = gethostbyname(name.nodename);
+ #else
+ char name[256];
+ gethostname(name, sizeof(name));
+ name[sizeof(name)-1] = 0;
+ hp = gethostbyname(name);
+ #endif /* HAVE_UNAME */
cp = strchr(hp->h_name, '.');
if (cp)
def_domain = strdup(++cp);
Index: clients/moira/lists.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/lists.c,v
retrieving revision 1.38
diff -c -r1.38 lists.c
*** lists.c 2000/01/07 21:14:05 1.38
--- lists.c 2000/03/13 23:45:20
***************
*** 732,738 ****
{
char *args[10];
int status;
- char temp_buf[BUFSIZ];
if (GetMemberInfo("tag", args) == SUB_ERROR)
return DM_NORMAL;
--- 732,737 ----
Index: clients/moira/main.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/main.c,v
retrieving revision 1.37
diff -c -r1.37 main.c
*** main.c 2000/01/28 00:03:23 1.37
--- main.c 2000/03/14 23:22:58
***************
*** 19,38 ****
#include "f_defs.h"
#include "globals.h"
- #include <pwd.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
- #include <krb.h>
-
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/main.c,v 1.37 2000/01/28 00:03:23 danw Exp $");
static void ErrorExit(char *buf, int status);
static void Usage(void);
! static void Signal_Handler(void);
! static void CatchInterrupt(void);
char *whoami; /* used by menu.c ugh!!! */
char *moira_server;
--- 19,38 ----
#include "f_defs.h"
#include "globals.h"
#include <signal.h>
#include <stdio.h>
#include <string.h>
+ #ifdef HAVE_UNISTD_H
#include <unistd.h>
+ #endif /* HAVE_UNISTD_H */
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/main.c,v 1.37 2000/01/28 00:03:23 danw Exp $");
static void ErrorExit(char *buf, int status);
static void Usage(void);
! static void Signal_Handler(int sig);
! static void CatchInterrupt(int sig);
! static void SetHandlers(void);
char *whoami; /* used by menu.c ugh!!! */
char *moira_server;
***************
*** 54,61 ****
{
int status;
Menu *menu;
! char **arg, pname[ANAME_SZ];
! struct sigaction act;
if (!(program_name = strrchr(argv[0], '/')))
program_name = argv[0];
--- 54,60 ----
{
int status;
Menu *menu;
! char **arg;
if (!(program_name = strrchr(argv[0], '/')))
program_name = argv[0];
***************
*** 132,152 ****
* These signals should not be set until just before we fire up the menu
* system.
*/
!
! sigemptyset(&act.sa_mask);
! act.sa_flags = 0;
! act.sa_handler = Signal_Handler;
! sigaction(SIGHUP, &act, NULL);
! sigaction(SIGQUIT, &act, NULL);
! #ifdef HAVE_CURSES
! if (use_menu)
! sigaction(SIGINT, &act, NULL);
! else
! #endif
! {
! act.sa_handler = CatchInterrupt;
! sigaction(SIGINT, &act, NULL);
! }
if (!strcmp(program_name, "listmaint"))
menu = &list_menu;
--- 131,137 ----
* These signals should not be set until just before we fire up the menu
* system.
*/
! SetHandlers();
if (!strcmp(program_name, "listmaint"))
menu = &list_menu;
***************
*** 205,211 ****
* Returns: doesn't
*/
! static void Signal_Handler(void)
{
Put_message("Signal caught - exiting");
#ifdef HAVE_CURSES
--- 190,196 ----
* Returns: doesn't
*/
! static void Signal_Handler(int sig)
{
Put_message("Signal caught - exiting");
#ifdef HAVE_CURSES
***************
*** 217,224 ****
}
! static void CatchInterrupt(void)
{
Put_message("Interrupt! Press RETURN to continue");
interrupt = 1;
}
--- 202,242 ----
}
! static void CatchInterrupt(int sig)
{
Put_message("Interrupt! Press RETURN to continue");
interrupt = 1;
}
+
+ #ifdef HAVE_POSIX_SIGNALS
+ static void SetHandlers(void)
+ {
+ struct sigaction act;
+
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = Signal_Handler;
+ sigaction(SIGHUP, &act, NULL);
+ sigaction(SIGQUIT, &act, NULL);
+ #ifdef HAVE_CURSES
+ if (use_menu)
+ sigaction(SIGINT, &act, NULL);
+ else
+ #endif
+ {
+ act.sa_handler = CatchInterrupt;
+ sigaction(SIGINT, &act, NULL);
+ }
+ }
+ #else
+ static void SetHandlers(void)
+ {
+ signal(SIGTERM, Signal_Handler);
+ #ifdef HAVE_CURSES
+ if (use_menu)
+ signal(SIGINT, Signal_Handler);
+ else
+ #endif
+ signal(SIGINT, CatchInterrupt);
+ }
+ #endif
Index: clients/moira/menu.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/menu.c,v
retrieving revision 1.57
diff -c -r1.57 menu.c
*** menu.c 2000/02/21 21:37:19 1.57
--- menu.c 2000/03/14 22:11:52
***************
*** 19,25 ****
--- 19,37 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifdef HAVE_UNISTD_H
#include <unistd.h>
+ #endif
+
+ #ifdef _WIN32
+ #include <windows.h>
+ #include <conio.h>
+ #ifdef getchar
+ #undef getchar
+ #endif
+ #define getchar() _getch()
+ #define getpid _getpid
+ #endif /* _WIN32 */
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/menu.c,v 1.57 2000/02/21 21:37:19 rbasch Exp $");
***************
*** 457,467 ****
/* Prompt the user for input in the input window of cur_ms */
int Prompt_input(char *prompt, char *buf, int buflen)
{
int c;
char *p;
int y, x, oldx, oldy;
- #ifdef HAVE_CURSES
if (cur_ms != NULLMS)
{
more_flg = 1;
--- 469,479 ----
/* Prompt the user for input in the input window of cur_ms */
int Prompt_input(char *prompt, char *buf, int buflen)
{
+ #ifdef HAVE_CURSES
int c;
char *p;
int y, x, oldx, oldy;
if (cur_ms != NULLMS)
{
more_flg = 1;
***************
*** 641,649 ****
/* Will be truncated to COLS characters. */
void Put_line(char *msg)
{
- int y, x, i;
- char *msg1, chr;
-
if (!more_flg)
return;
--- 653,658 ----
***************
*** 655,660 ****
--- 664,672 ----
#ifdef HAVE_CURSES
if (cur_ms != NULLMS)
{
+ int x, y;
+ char chr;
+
wstandout(cur_ms->ms_input);
wprintw(cur_ms->ms_input, "---More---");
wstandend(cur_ms->ms_input);
***************
*** 684,689 ****
--- 696,704 ----
#ifdef HAVE_CURSES
if (cur_ms != NULLMS)
{
+ int i;
+ char *msg1;
+
msg1 = calloc(COLS, 1);
strncpy(msg1, msg, COLS - 1);
for (i = strlen(msg1); i < COLS - 1; i++)
***************
*** 766,778 ****
return find_command_from(command, m, MAX_MENU_DEPTH);
}
int toggle_logging(int argc, char *argv[])
{
char buf[BUFSIZ];
if (!log_file)
{
! sprintf(buf, "/var/tmp/%s-log.%ld", whoami, (long)getpid());
/* open the file */
log_file = fopen(buf, "a");
--- 781,810 ----
return find_command_from(command, m, MAX_MENU_DEPTH);
}
+ static char *get_tmp_dir(void)
+ {
+ #ifdef _WIN32
+ static char tmp[BUFSIZ];
+ DWORD len;
+ if (!tmp[0])
+ {
+ len = GetTempPath(sizeof(tmp), tmp);
+ if (!len || (len > sizeof(tmp)))
+ strcpy(tmp, ".");
+ }
+ return tmp;
+ #else
+ return "/var/tmp";
+ #endif
+ }
+
int toggle_logging(int argc, char *argv[])
{
char buf[BUFSIZ];
if (!log_file)
{
! sprintf(buf, "%s/%s-log.%ld", get_tmp_dir(), whoami, (long)getpid());
/* open the file */
log_file = fopen(buf, "a");
Index: clients/moira/misc.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/misc.c,v
retrieving revision 1.11
diff -c -r1.11 misc.c
*** misc.c 1998/10/22 18:29:35 1.11
--- misc.c 2000/03/13 23:45:20
***************
*** 23,32 ****
--- 23,34 ----
#include "globals.h"
#include <sys/types.h>
+ #ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+ #endif /* _WIN32 */
#include <stdio.h>
#include <stdlib.h>
Index: clients/moira/pobox.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/pobox.c,v
retrieving revision 1.33
diff -c -r1.33 pobox.c
*** pobox.c 2000/02/18 17:07:58 1.33
--- pobox.c 2000/03/14 22:13:21
***************
*** 395,401 ****
{
int status;
char *type, temp_buf[BUFSIZ], *local_user, *args[10], *box;
- char *temp_box;
struct mqelem *top = NULL;
local_user = argv[1];
--- 395,400 ----
Index: clients/moira/printer.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/printer.c,v
retrieving revision 1.26
diff -c -r1.26 printer.c
*** printer.c 1999/08/04 14:58:08 1.26
--- printer.c 2000/03/13 23:45:21
***************
*** 207,213 ****
{
char temp_buf[BUFSIZ];
char *args[3], *lpc_acl;
- char *s, *d;
int status;
Put_message("");
--- 207,212 ----
***************
*** 526,532 ****
static char *PrintPrintSrvInfo(char **info)
{
char buf[BUFSIZ];
- int status;
if (!info) /* If no informaion */
{
--- 525,530 ----
***************
*** 575,583 ****
static char **AskPrintSrvInfo(char **info)
{
char buf[BUFSIZ];
- char *args[3], *lpc_acl;
- char *s, *d;
- int status;
Put_message("");
sprintf(buf, "Print Server entry for %s.", info[PRINTSERVER_HOST]);
--- 573,578 ----
***************
*** 644,650 ****
int ChangePrintSrv(int argc, char **argv)
{
! char *name, **args;
struct mqelem *elem = NULL;
int stat;
--- 639,645 ----
int ChangePrintSrv(int argc, char **argv)
{
! char *name;
struct mqelem *elem = NULL;
int stat;
Index: clients/moira/user.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/user.c,v
retrieving revision 1.56
diff -c -r1.56 user.c
*** user.c 2000/03/09 19:59:54 1.56
--- user.c 2000/03/13 23:45:21
***************
*** 19,26 ****
#include "f_defs.h"
#include "globals.h"
- #include <sys/time.h>
-
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
--- 19,24 ----
***************
*** 188,194 ****
char **AskUserInfo(char **info, Bool name)
{
! int i, state;
char temp_buf[BUFSIZ], *newname;
if (name)
--- 186,192 ----
char **AskUserInfo(char **info, Bool name)
{
! int state;
char temp_buf[BUFSIZ], *newname;
if (name)
***************
*** 698,704 ****
FreeAndClear(&args[L_MODTIME], TRUE);
FreeAndClear(&args[L_MODBY], TRUE);
FreeAndClear(&args[L_MODWITH], TRUE);
! SlipInNewName(args, args[L_NAME]);
if ((status = do_mr_query("update_list", CountArgs(args), args,
NULL, NULL)))
{
--- 696,702 ----
FreeAndClear(&args[L_MODTIME], TRUE);
FreeAndClear(&args[L_MODBY], TRUE);
FreeAndClear(&args[L_MODWITH], TRUE);
! SlipInNewName(args, strdup(args[L_NAME]));
if ((status = do_mr_query("update_list", CountArgs(args), args,
NULL, NULL)))
{
***************
*** 734,740 ****
FreeAndClear(&args[FS_MODTIME], TRUE);
FreeAndClear(&args[FS_MODBY], TRUE);
FreeAndClear(&args[FS_MODWITH], TRUE);
! SlipInNewName(args, args[FS_NAME]);
if ((status = do_mr_query("update_filesys", CountArgs(args), args,
NULL, NULL)))
{
--- 732,738 ----
FreeAndClear(&args[FS_MODTIME], TRUE);
FreeAndClear(&args[FS_MODBY], TRUE);
FreeAndClear(&args[FS_MODWITH], TRUE);
! SlipInNewName(args, strdup(args[FS_NAME]));
if ((status = do_mr_query("update_filesys", CountArgs(args), args,
NULL, NULL)))
{
Index: clients/moira/utils.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/utils.c,v
retrieving revision 1.46
diff -c -r1.46 utils.c
*** utils.c 2000/01/26 18:04:53 1.46
--- utils.c 2000/03/14 00:05:03
***************
*** 21,29 ****
--- 21,31 ----
#include <sys/types.h>
+ #ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h> /* for gethostbyname. */
+ #endif /* _WIN32 */
#include <ctype.h>
#include <stdio.h>
***************
*** 777,787 ****
--- 779,793 ----
strcat(buffer, " (");
for (elem = GetTypeValues(tname); elem; elem = elem->q_forw)
{
+ /* Make sure we don't blow up and get too long a prompt */
+ if (strlen(buffer) > 64)
+ break;
strcat(buffer, elem->q_data);
if (elem->q_forw)
strcat(buffer, ", ");
}
strcat(buffer, ")");
+ /* Trim the prompt if it is too long */
if (strlen(buffer) > 64)
sprintf(buffer, "%s (? for help)", prompt);
if (GetValueFromUser(buffer, pointer) == SUB_ERROR)
Index: clients/mrcheck/mrcheck.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/mrcheck/mrcheck.c,v
retrieving revision 1.18
diff -c -r1.18 mrcheck.c
*** mrcheck.c 1999/12/30 17:30:36 1.18
--- mrcheck.c 2000/03/13 23:45:21
***************
*** 12,19 ****
#include <moira_site.h>
#include <mrclient.h>
- #include <sys/time.h>
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--- 12,17 ----
***************
*** 30,36 ****
char *whoami;
static int count = 0;
! static struct timeval now;
struct service {
char name[17];
--- 28,34 ----
char *whoami;
static int count = 0;
! static time_t now;
struct service {
char name[17];
***************
*** 78,84 ****
disp_svc(argv, "Should this be enabled?\n");
else if (atoi(argv[SVC_ENABLE]) &&
60 * atoi(argv[SVC_INTERVAL]) + 86400 + atoi(argv[SVC_DFCHECK])
! < now.tv_sec)
disp_svc(argv, "Service has not been updated\n");
return MR_CONT;
--- 76,82 ----
disp_svc(argv, "Should this be enabled?\n");
else if (atoi(argv[SVC_ENABLE]) &&
60 * atoi(argv[SVC_INTERVAL]) + 86400 + atoi(argv[SVC_DFCHECK])
! < now)
disp_svc(argv, "Service has not been updated\n");
return MR_CONT;
***************
*** 130,136 ****
disp_sh(argv, "Should this be enabled?\n");
else if (atoi(argv[SH_ENABLE]) && update_int &&
60 * atoi(update_int) + 86400 + atoi(argv[SH_LASTSUCCESS])
! < now.tv_sec)
disp_sh(argv, "Host has not been updated\n");
return MR_CONT;
--- 128,134 ----
disp_sh(argv, "Should this be enabled?\n");
else if (atoi(argv[SH_ENABLE]) && update_int &&
60 * atoi(update_int) + 86400 + atoi(argv[SH_LASTSUCCESS])
! < now)
disp_sh(argv, "Host has not been updated\n");
return MR_CONT;
***************
*** 187,193 ****
goto punt;
}
! gettimeofday(&now, 0);
sq = sq_create();
/* Check services first */
--- 185,191 ----
goto punt;
}
! now = time(NULL);
sq = sq_create();
/* Check services first */
Index: clients/mrtest/mrtest.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/mrtest/mrtest.c,v
retrieving revision 1.48
diff -c -r1.48 mrtest.c
*** mrtest.c 1999/12/30 17:30:37 1.48
--- mrtest.c 2000/03/14 23:19:14
***************
*** 17,24 ****
--- 17,43 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifdef HAVE_UNISTD_H
#include <unistd.h>
+ #endif
+
+ #ifdef HAVE_GETOPT_H
+ #include <getopt.h>
+ #endif
+ #ifdef _WIN32
+ #include <windows.h>
+ #include <io.h>
+ #define dup _dup
+ #define dup2 _dup2
+ #define isatty _isatty
+ #define close _close
+ #define open _open
+ #define sigjmp_buf jmp_buf
+ #define siglongjmp longjmp
+ #define sigsetjmp(env, save) setjmp(env)
+ #endif /* _WIN32 */
+
#ifdef HAVE_READLINE
#include "readline/readline.h"
#include "readline/history.h"
***************
*** 29,39 ****
int recursion = 0, quote_output = 0, interactive;
int count, quit = 0, cancel = 0;
char *whoami;
sigjmp_buf jb;
#define MAXARGS 20
! void discard_input(void);
char *mr_gets(char *prompt, char *buf, size_t len);
void execute_line(char *cmdbuf);
int parse(char *buf, char *argv[MAXARGS]);
--- 48,59 ----
int recursion = 0, quote_output = 0, interactive;
int count, quit = 0, cancel = 0;
char *whoami;
+
sigjmp_buf jb;
#define MAXARGS 20
! void discard_input(int sig);
char *mr_gets(char *prompt, char *buf, size_t len);
void execute_line(char *cmdbuf);
int parse(char *buf, char *argv[MAXARGS]);
***************
*** 51,61 ****
void test_script(int argc, char **argv);
void test_list_requests(void);
void test_version(int argc, char **argv);
int main(int argc, char **argv)
{
char cmdbuf[BUFSIZ];
- struct sigaction action;
int c;
whoami = argv[0];
--- 71,82 ----
void test_script(int argc, char **argv);
void test_list_requests(void);
void test_version(int argc, char **argv);
+ void set_signal_handler(int, void (*handler)(int));
+ void set_signal_blocking(int, int);
int main(int argc, char **argv)
{
char cmdbuf[BUFSIZ];
int c;
whoami = argv[0];
***************
*** 83,92 ****
rl_bind_key('\t', rl_insert);
#endif
! action.sa_handler = discard_input;
! action.sa_flags = 0;
! sigemptyset(&action.sa_mask);
! sigaction(SIGINT, &action, NULL);
sigsetjmp(jb, 1);
while (!quit)
--- 104,110 ----
rl_bind_key('\t', rl_insert);
#endif
! set_signal_handler(SIGINT, discard_input);
sigsetjmp(jb, 1);
while (!quit)
***************
*** 99,105 ****
exit(0);
}
! void discard_input(void)
{
putc('\n', stdout);
--- 117,123 ----
exit(0);
}
! void discard_input(int sig)
{
putc('\n', stdout);
***************
*** 432,438 ****
void test_query(int argc, char **argv)
{
int status, help;
- sigset_t sigs;
if (argc < 2)
{
--- 450,455 ----
***************
*** 444,454 ****
count = 0;
/* Don't allow ^C during the query: it will confuse libmoira's
internal state. (Yay static variables) */
! sigemptyset(&sigs);
! sigaddset(&sigs, SIGINT);
! sigprocmask(SIG_BLOCK, &sigs, NULL);
status = mr_query(argv[1], argc - 2, argv + 2, print_reply, &help);
! sigprocmask(SIG_UNBLOCK, &sigs, NULL);
printf("%d tuple%s\n", count, ((count == 1) ? "" : "s"));
if (status)
com_err("moira (query)", status, "");
--- 461,469 ----
count = 0;
/* Don't allow ^C during the query: it will confuse libmoira's
internal state. (Yay static variables) */
! set_signal_blocking(SIGINT, 1);
status = mr_query(argv[1], argc - 2, argv + 2, print_reply, &help);
! set_signal_blocking(SIGINT, 0);
printf("%d tuple%s\n", count, ((count == 1) ? "" : "s"));
if (status)
com_err("moira (query)", status, "");
***************
*** 520,522 ****
--- 535,578 ----
if (status)
com_err("moira (version)", status, "");
}
+
+ #ifdef HAVE_POSIX_SIGNALS
+
+ void set_signal_handler(int sig, void (*handler)(int))
+ {
+ struct sigaction action;
+
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ action.sa_handler = handler;
+ sigaction(sig, &action, NULL);
+ }
+
+ void set_signal_blocking(int sig, int block)
+ {
+ sigset_t sigs;
+ sigemptyset(&sigs);
+ sigaddset(&sigs, sig);
+ sigprocmask(block ? SIG_BLOCK : SIG_UNBLOCK, &sigs, NULL);
+ }
+
+ #else
+
+ void set_signal_handler(int sig, void (*handler)(int))
+ {
+ signal(sig, handler);
+ }
+
+ #ifdef _WIN32
+ BOOL WINAPI blocking_handler(DWORD dwCtrlType)
+ {
+ return(TRUE);
+ }
+
+ void set_signal_blocking(int sig, int block)
+ {
+ SetConsoleCtrlHandler(blocking_handler, block ? TRUE : FALSE);
+ }
+ #endif /* _WIN32 */
+
+ #endif /* HAVE_POSIX_SIGNALS */
Index: clients/passwd/chfn.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/passwd/chfn.c,v
retrieving revision 1.20
diff -c -r1.20 chfn.c
*** chfn.c 1999/12/30 17:30:37 1.20
--- chfn.c 2000/03/13 23:45:21
***************
*** 75,81 ****
int status; /* general purpose exit status */
int q_argc; /* argc for mr_query */
char *q_argv[F_END]; /* argv for mr_query */
- char *motd; /* for Moira server status */
int i;
struct finger_info old_info;
--- 75,80 ----
***************
*** 175,180 ****
--- 174,180 ----
char *result;
int i;
int dashes = FALSE;
+ int len;
#define BLANK "none"
***************
*** 192,198 ****
else
result = buf;
! for (i = 0; i < strlen(buf); i++)
{
switch (buf[i])
{
--- 192,199 ----
else
result = buf;
! len = strlen(buf);
! for (i = 0; i < len; i++)
{
switch (buf[i])
{
***************
*** 222,228 ****
if (phone_num && ok)
{
! for (i = 0; i < strlen(result); i++)
{
if (!isdigit(result[i]) && (result[i] != '-'))
{
--- 223,230 ----
if (phone_num && ok)
{
! len = strlen(result);
! for (i = 0; i < len; i++)
{
if (!isdigit(result[i]) && (result[i] != '-'))
{
Index: clients/passwd/chpobox.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/passwd/chpobox.c,v
retrieving revision 1.28
diff -c -r1.28 chpobox.c
*** chpobox.c 2000/01/28 00:31:55 1.28
--- chpobox.c 2000/03/14 22:48:46
***************
*** 26,36 ****
#include <moira_site.h>
#include <mrclient.h>
- #include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/passwd/chpobox.c,v 1.28 2000/01/28 00:31:55 danw Exp $");
--- 26,40 ----
#include <moira_site.h>
#include <mrclient.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifdef HAVE_UNISTD_H
#include <unistd.h>
+ #endif
+ #ifdef HAVE_GETOPT_H
+ #include <getopt.h>
+ #endif
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/passwd/chpobox.c,v 1.28 2000/01/28 00:31:55 danw Exp $");
***************
*** 43,49 ****
int main(int argc, char *argv[])
{
- struct passwd *pwd;
char *mrarg[3];
char *address, *uname;
int c, setflag, splitflag, prevflag, status;
--- 47,52 ----
Index: clients/stella/stella.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/stella/stella.c,v
retrieving revision 1.1
diff -c -r1.1 stella.c
*** stella.c 2000/02/10 05:33:44 1.1
--- stella.c 2000/03/13 23:45:22
***************
*** 78,84 ****
{
int status, success;
char **arg = argv;
! char *server = NULL, *p;
/* clear all flags & lists */
info_flag = update_flag = create_flag = list_map_flag = update_map_flag = 0;
--- 78,84 ----
{
int status, success;
char **arg = argv;
! char *server = NULL;
/* clear all flags & lists */
info_flag = update_flag = create_flag = list_map_flag = update_map_flag = 0;
***************
*** 138,149 ****
else if (argis("S", "status")) {
if (arg - argv < argc - 1) {
int i;
arg++;
update_flag++;
h_status = *arg;
! for(i=0; i<strlen(h_status); i++) {
if(!isdigit(h_status[i])) {
printf("Error: status code %s is not numeric.\n", h_status);
exit(1);
--- 138,151 ----
else if (argis("S", "status")) {
if (arg - argv < argc - 1) {
int i;
+ int len;
arg++;
update_flag++;
h_status = *arg;
! len = strlen(h_status);
! for(i = 0; i < len; i++) {
if(!isdigit(h_status[i])) {
printf("Error: status code %s is not numeric.\n", h_status);
exit(1);
***************
*** 366,372 ****
char *old_argv[30];
char *argv[16];
char *args[5];
- int cnt;
args[0] = canonicalize_hostname(strdup(hostname));
args[1] = args[2] = args[3] = "*";
--- 368,373 ----
***************
*** 584,614 ****
void usage(char **argv)
{
fprintf(stderr, "Usage: %s hostname [options]\n", argv[0]);
fprintf(stderr, "Options are\n");
! fprintf(stderr, " %-39s%-39s\n", "-C | -create",
"-O | -owner owner");
! fprintf(stderr, " %-39s%-39s\n", "-D | -delete",
"-S | -status status");
! fprintf(stderr, " %-39s%-39s\n", "-R | -rename newname",
"-V | -vendor vendor");
! fprintf(stderr, " %-39s%-39s\n", "-a | -addalias alias",
"-M | -model model");
! fprintf(stderr, " %-39s%-39s\n", "-d | -deletealias alias",
"-L | -location location");
! fprintf(stderr, " %-39s%-39s\n", "-i | -info",
"-o | -os os");
! fprintf(stderr, " %-39s%-39s\n", "-oc | -opcmt op_cmt",
"-c | -contact contact");
! fprintf(stderr, " %-39s%-39s\n", "-ac | -admcmt adm_cmt",
"-A | -address address");
! fprintf(stderr, " %-39s%-39s\n", "-am | -addmap cluster",
"-N | -network network");
! fprintf(stderr, " %-39s%-39s\n", "-dm | -deletemap cluster",
"-lm | -listmap");
! fprintf(stderr, " %-39s%-39s\n", "-db | -database host[:port]",
"-n | -noauth");
! fprintf(stderr, " %-39s%-39s\n", "-v | -verbose",
"");
exit(1);
}
--- 585,616 ----
void usage(char **argv)
{
+ #define USAGE_OPTIONS_FORMAT " %-39s%s\n"
fprintf(stderr, "Usage: %s hostname [options]\n", argv[0]);
fprintf(stderr, "Options are\n");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-C | -create",
"-O | -owner owner");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-D | -delete",
"-S | -status status");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-R | -rename newname",
"-V | -vendor vendor");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-a | -addalias alias",
"-M | -model model");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-d | -deletealias alias",
"-L | -location location");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-i | -info",
"-o | -os os");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-oc | -opcmt op_cmt",
"-c | -contact contact");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-ac | -admcmt adm_cmt",
"-A | -address address");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-am | -addmap cluster",
"-N | -network network");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-dm | -deletemap cluster",
"-lm | -listmap");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-db | -database host[:port]",
"-n | -noauth");
! fprintf(stderr, USAGE_OPTIONS_FORMAT, "-v | -verbose",
"");
exit(1);
}
Index: include/moira.h
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/include/moira.h,v
retrieving revision 1.27
diff -c -r1.27 moira.h
*** moira.h 2000/01/28 00:03:27 1.27
--- moira.h 2000/03/13 23:45:22
***************
*** 7,19 ****
#ifndef _moira_h_
#define _moira_h_
! /* return values from queries (and error codes) */
#include <sys/types.h>
#include <com_err.h>
#include "mr_et.h"
#include "krb_et.h"
#include "ureg_err.h"
#define MR_SUCCESS 0 /* Query was successful */
#define MR_VERSION_1 1 /* Version in use from 7/87 to 4/88 */
--- 7,26 ----
#ifndef _moira_h_
#define _moira_h_
! #ifdef _WIN32
! #include <windows.h>
! #ifndef strcasecmp
! #define strcasecmp stricmp
! #endif
! #endif /*_WIN32 */
+ /* return values from queries (and error codes) */
#include <sys/types.h>
#include <com_err.h>
#include "mr_et.h"
#include "krb_et.h"
#include "ureg_err.h"
+
#define MR_SUCCESS 0 /* Query was successful */
#define MR_VERSION_1 1 /* Version in use from 7/87 to 4/88 */
***************
*** 125,130 ****
--- 132,138 ----
char *strtrim(char *s);
char *uppercase(char *s);
char *lowercase(char *s);
+
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t size);
#endif
Index: lib/fixhost.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/fixhost.c,v
retrieving revision 1.22
diff -c -r1.22 fixhost.c
*** fixhost.c 1999/12/14 20:43:58 1.22
--- fixhost.c 2000/03/14 22:51:37
***************
*** 11,21 ****
#include <moira.h>
#include <sys/types.h>
! #include <sys/socket.h>
#include <sys/utsname.h>
#include <netdb.h>
#include <netinet/in.h>
#include <ctype.h>
#include <stdio.h>
--- 11,26 ----
#include <moira.h>
#include <sys/types.h>
!
! #ifdef HAVE_UNAME
#include <sys/utsname.h>
+ #endif
+ #ifndef _WIN32
+ #include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
+ #endif /* _WIN32 */
#include <ctype.h>
#include <stdio.h>
***************
*** 24,29 ****
--- 29,48 ----
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/fixhost.c,v 1.22 1999/12/14 20:43:58 danw Exp $");
+ static struct hostent *local_gethostbyname(void)
+ {
+ #ifdef HAVE_UNAME
+ struct utsname name;
+ uname(&name);
+ return gethostbyname(name.nodename);
+ #else
+ char hostname[128];
+ gethostname(hostname, sizeof(hostname));
+ hostname[sizeof(hostname)-1] = 0;
+ return gethostbyname(hostname);
+ #endif
+ }
+
static char *local_domain(void)
{
static char *domain = NULL;
***************
*** 42,50 ****
}
else
{
! struct utsname name;
! uname(&name);
! hp = gethostbyname(name.nodename);
if (hp)
{
cp = strchr(hp->h_name, '.');
--- 61,67 ----
}
else
{
! hp = local_gethostbyname();
if (hp)
{
cp = strchr(hp->h_name, '.');
Index: lib/mr_call.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_call.c,v
retrieving revision 1.17
diff -c -r1.17 mr_call.c
*** mr_call.c 2000/01/31 15:44:16 1.17
--- mr_call.c 2000/03/14 22:52:46
***************
*** 12,21 ****
#include "mr_private.h"
#include <errno.h>
- #include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_call.c,v 1.17 2000/01/31 15:44:16 danw Exp $");
--- 12,26 ----
#include "mr_private.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+ #ifndef _WIN32
+ #include <netinet/in.h>
+ #endif /* _WIN32 */
+
+ #ifdef HAVE_UNISTD_H
#include <unistd.h>
+ #endif
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_call.c,v 1.17 2000/01/31 15:44:16 danw Exp $");
***************
*** 53,59 ****
int mr_send(int fd, struct mr_params *params)
{
! u_long length, written;
int i, *argl;
char *buf, *p;
--- 58,65 ----
int mr_send(int fd, struct mr_params *params)
{
! u_long length;
! int written;
int i, *argl;
char *buf, *p;
***************
*** 99,110 ****
length = p - buf;
putlong(buf, length);
! written = write(fd, buf, length);
free(buf);
if (!params->mr_argl)
free(argl);
! if (written != length)
return MR_ABORTED;
else
return MR_SUCCESS;
--- 105,116 ----
length = p - buf;
putlong(buf, length);
! written = send(fd, buf, length, 0);
free(buf);
if (!params->mr_argl)
free(argl);
! if (written != (int)length)
return MR_ABORTED;
else
return MR_SUCCESS;
***************
*** 127,136 ****
* on failure, or -1 if the packet hasn't been completely received
* yet.
*/
int mr_cont_receive(int fd, struct mr_params *reply)
{
u_long length, data;
! ssize_t size, more;
char *p, *end;
int i;
--- 133,143 ----
* on failure, or -1 if the packet hasn't been completely received
* yet.
*/
+
int mr_cont_receive(int fd, struct mr_params *reply)
{
u_long length, data;
! int size, more;
char *p, *end;
int i;
***************
*** 138,144 ****
{
char lbuf[4];
! size = read(fd, lbuf, 4);
if (size != 4)
return size ? MR_ABORTED : MR_NOT_CONNECTED;
getlong(lbuf, length);
--- 145,151 ----
{
char lbuf[4];
! size = recv(fd, lbuf, 4, 0);
if (size != 4)
return size ? MR_ABORTED : MR_NOT_CONNECTED;
getlong(lbuf, length);
***************
*** 155,162 ****
else
getlong(reply->mr_flattened, length);
! more = read(fd, reply->mr_flattened + reply->mr_filled,
! length - reply->mr_filled);
if (more == -1)
{
mr_destroy_reply(*reply);
--- 162,169 ----
else
getlong(reply->mr_flattened, length);
! more = recv(fd, reply->mr_flattened + reply->mr_filled,
! length - reply->mr_filled, 0);
if (more == -1)
{
mr_destroy_reply(*reply);
***************
*** 177,183 ****
getlong(reply->mr_flattened + 8, reply->u.mr_status);
getlong(reply->mr_flattened + 12, reply->mr_argc);
! if (reply->mr_argc > (length - 16) / 8)
{
mr_destroy_reply(*reply);
return MR_INTERNAL;
--- 184,190 ----
getlong(reply->mr_flattened + 8, reply->u.mr_status);
getlong(reply->mr_flattened + 12, reply->mr_argc);
! if (reply->mr_argc > ((int)length - 16) / 8)
{
mr_destroy_reply(*reply);
return MR_INTERNAL;
Index: lib/mr_connect.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_connect.c,v
retrieving revision 1.32
diff -c -r1.32 mr_connect.c
*** mr_connect.c 2000/02/16 18:12:10 1.32
--- mr_connect.c 2000/03/14 22:55:18
***************
*** 14,35 ****
#include "mr_private.h"
#include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netdb.h>
-
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_HESIOD
#include <hesiod.h>
#endif
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_connect.c,v 1.32 2000/02/16 18:12:10 zacheiss Exp $");
int _mr_conn = 0;
static char *mr_server_host = NULL;
--- 14,49 ----
#include "mr_private.h"
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+
+ #ifdef HAVE_UNISTD_H
#include <unistd.h>
+ #endif
+ #ifndef _WIN32
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #ifndef closesocket
+ #define closesocket close
+ #endif
+ #ifndef SOCKET_ERROR
+ #define SOCKET_ERROR -1
+ #endif
+ #endif
+
#ifdef HAVE_HESIOD
#include <hesiod.h>
#endif
RCSID("$Header: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_connect.c,v 1.32 2000/02/16 18:12:10 zacheiss Exp $");
+ #define DEFAULT_SERV "moira_db"
+ #define DEFAULT_PORT 775
+
int _mr_conn = 0;
static char *mr_server_host = NULL;
***************
*** 119,194 ****
int mr_connect_internal(char *server, char *port)
{
! int fd, size, more;
struct sockaddr_in target;
struct hostent *shost;
char actualresponse[53];
shost = gethostbyname(server);
if (!shost)
! return 0;
if (port[0] == '#')
! target.sin_port = htons(atoi(port + 1));
else
{
struct servent *s;
s = getservbyname(port, "tcp");
if (s)
target.sin_port = s->s_port;
- else
#ifdef HAVE_HESIOD
{
s = hes_getservbyname(port, "tcp");
if (s)
target.sin_port = s->s_port;
- else
- return 0;
}
- #else
- return 0;
#endif
}
- memcpy(&target.sin_addr, shost->h_addr, shost->h_length);
- target.sin_family = shost->h_addrtype;
-
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0)
! return 0;
if (connect(fd, (struct sockaddr *)&target, sizeof(target)) < 0)
! {
! close(fd);
! return 0;
! }
/* Do magic mrgdb initialization */
! size = write(fd, challenge, sizeof(challenge));
if (size != sizeof(challenge))
! {
! close(fd);
! return 0;
! }
for (size = 0; size < sizeof(actualresponse); size += more)
{
! more = read(fd, actualresponse + size, sizeof(actualresponse) - size);
if (more <= 0)
break;
}
if (size != sizeof(actualresponse))
! {
! close(fd);
! return 0;
! }
if (memcmp(actualresponse, response, sizeof(actualresponse)))
{
! close(fd);
return 0;
}
-
- mr_server_host = strdup(shost->h_name);
-
/* You win */
return fd;
}
--- 133,212 ----
int mr_connect_internal(char *server, char *port)
{
! int size, more;
struct sockaddr_in target;
struct hostent *shost;
char actualresponse[53];
+ char *host = NULL;
+ int fd = SOCKET_ERROR;
+ int ok = 0;
shost = gethostbyname(server);
if (!shost)
! goto cleanup;
!
! /* Get the host info in case some library decides to clobber shost. */
! memcpy(&target.sin_addr, shost->h_addr, shost->h_length);
! target.sin_family = shost->h_addrtype;
! host = strdup(shost->h_name);
if (port[0] == '#')
! target.sin_port = htons((unsigned short)atoi(port + 1));
else
{
struct servent *s;
+ target.sin_port = 0;
s = getservbyname(port, "tcp");
if (s)
target.sin_port = s->s_port;
#ifdef HAVE_HESIOD
+ if (!target.sin_port)
{
s = hes_getservbyname(port, "tcp");
if (s)
target.sin_port = s->s_port;
}
#endif
+ if (!target.sin_port && !strcasecmp(port, DEFAULT_SERV))
+ target.sin_port = htons(DEFAULT_PORT);
+ if (!target.sin_port)
+ goto cleanup;
}
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0)
! goto cleanup;
if (connect(fd, (struct sockaddr *)&target, sizeof(target)) < 0)
! goto cleanup;
/* Do magic mrgdb initialization */
! size = send(fd, challenge, sizeof(challenge), 0);
if (size != sizeof(challenge))
! goto cleanup;
for (size = 0; size < sizeof(actualresponse); size += more)
{
! more = recv(fd, actualresponse + size, sizeof(actualresponse) - size, 0);
if (more <= 0)
break;
}
if (size != sizeof(actualresponse))
! goto cleanup;
if (memcmp(actualresponse, response, sizeof(actualresponse)))
+ goto cleanup;
+
+ ok = 1;
+ mr_server_host = host;
+
+ cleanup:
+ if (!ok)
{
! if (host)
! free(host);
! if (fd != SOCKET_ERROR)
! closesocket(fd);
return 0;
}
/* You win */
return fd;
}
***************
*** 196,202 ****
int mr_disconnect(void)
{
CHECK_CONNECTED;
! close(_mr_conn);
_mr_conn = 0;
free(mr_server_host);
mr_server_host = NULL;
--- 214,220 ----
int mr_disconnect(void)
{
CHECK_CONNECTED;
! closesocket(_mr_conn);
_mr_conn = 0;
free(mr_server_host);
mr_server_host = NULL;
***************
*** 258,274 ****
return -1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(int)) < 0)
{
! close(s);
return -1;
}
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
{
! close(s);
return -1;
}
if (listen(s, 5) < 0)
{
! close(s);
return -1;
}
--- 276,292 ----
return -1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(int)) < 0)
{
! closesocket(s);
return -1;
}
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
{
! closesocket(s);
return -1;
}
if (listen(s, 5) < 0)
{
! closesocket(s);
return -1;
}
***************
*** 311,319 ****
if (!*buf)
{
char lbuf[4];
! if (read(conn, lbuf, 4) != 4)
{
! close(conn);
return 0;
}
getlong(lbuf, len);
--- 329,337 ----
if (!*buf)
{
char lbuf[4];
! if (recv(conn, lbuf, 4, 0) != 4)
{
! closesocket(conn);
return 0;
}
getlong(lbuf, len);
***************
*** 322,328 ****
*buf = malloc(len);
if (!*buf || len < 58)
{
! close(conn);
free(*buf);
return 0;
}
--- 340,346 ----
*buf = malloc(len);
if (!*buf || len < 58)
{
! closesocket(conn);
free(*buf);
return 0;
}
***************
*** 333,343 ****
else
getlong(*buf, len);
! more = read(conn, *buf + *nread, len - *nread);
if (more == -1 && errno != EINTR)
{
! close(conn);
free(*buf);
return 0;
}
--- 351,361 ----
else
getlong(*buf, len);
! more = recv(conn, *buf + *nread, len - *nread, 0);
if (more == -1 && errno != EINTR)
{
! closesocket(conn);
free(*buf);
return 0;
}
***************
*** 349,355 ****
if (memcmp(*buf + 4, challenge + 4, 34))
{
! close(conn);
free(*buf);
return 0;
}
--- 367,373 ----
if (memcmp(*buf + 4, challenge + 4, 34))
{
! closesocket(conn);
free(*buf);
return 0;
}
***************
*** 357,365 ****
/* good enough */
free(*buf);
! if (write(conn, response, sizeof(response)) != sizeof(response))
{
! close(conn);
return 0;
}
return conn;
--- 375,383 ----
/* good enough */
free(*buf);
! if (send(conn, response, sizeof(response), 0) != sizeof(response))
{
! closesocket(conn);
return 0;
}
return conn;
Index: lib/mr_private.h
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/lib/mr_private.h,v
retrieving revision 1.12
diff -c -r1.12 mr_private.h
*** mr_private.h 1998/07/15 20:39:32 1.12
--- mr_private.h 2000/03/13 23:45:22
***************
*** 12,19 ****
--- 12,21 ----
#include <sys/types.h>
+ #ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
+ #endif /*_WIN32*/
extern int _mr_conn, mr_inited;
***************
*** 32,38 ****
#define CHECK_CONNECTED if (!_mr_conn) return MR_NOT_CONNECTED
#define getlong(cp, l) do { l = ((((unsigned char *)cp)[0] * 256 + ((unsigned char *)cp)[1]) * 256 + ((unsigned char *)cp)[2]) * 256 + ((unsigned char *)cp)[3]; } while(0)
! #define putlong(cp, l) do { ((unsigned char *)cp)[0] = l >> 24; ((unsigned char *)cp)[1] = l >> 16; ((unsigned char *)cp)[2] = l >> 8; ((unsigned char *)cp)[3] = l; } while(0)
/* prototypes from mr_call.h */
int mr_do_call(struct mr_params *params, struct mr_params *reply);
--- 34,40 ----
#define CHECK_CONNECTED if (!_mr_conn) return MR_NOT_CONNECTED
#define getlong(cp, l) do { l = ((((unsigned char *)cp)[0] * 256 + ((unsigned char *)cp)[1]) * 256 + ((unsigned char *)cp)[2]) * 256 + ((unsigned char *)cp)[3]; } while(0)
! #define putlong(cp, l) do { ((unsigned char *)cp)[0] = (unsigned char)(l >> 24); ((unsigned char *)cp)[1] = (unsigned char)(l >> 16); ((unsigned char *)cp)[2] = (unsigned char)(l >> 8); ((unsigned char *)cp)[3] = (unsigned char)(l); } while(0)
/* prototypes from mr_call.h */
int mr_do_call(struct mr_params *params, struct mr_params *reply);