[1388] in Moira
Finalized Patches for Moira Support for Pismere
daemon@ATHENA.MIT.EDU (Danilo D Almeida)
Thu Mar 2 21:13:08 2000
Date: Thu, 2 Mar 2000 21:12:59 -0500 (EST)
Message-Id: <200003030212.VAA28074@fides.mit.edu>
From: Danilo D Almeida <dalmeida@MIT.EDU>
To: moiradev@mit.edu
I sat down with Dave and Bob today and we came up with a submission.
The submission tries to accomplish the following things:
1) make sure all the client code builds on windows with minimal disruption
of code:
- mailmaint uses curses on Windows
- moira client does not
- use socket API instead of Unix read/write/close calls in moira lib
- curses arrow-key sequences are different on Windows
- abstract out some of the platform differences for signal-handling
in places
- do not use gettimeofday() if time() will do
2) clean up unrefereced vars (warning-less builds)
3) explicitly cast value comparisons instead of using ambiguous implicit
behavior (warning-less builds)
- assigned strlen result to int instead of casting (since conversion for
assignments is defined) to address this issue as well as improve
performance a little bit in some places
4) putlong macro casts bytes it splits longs into before stuffing them so
as to avoid warnings
5) fix some memory leaks (even on exit)
- don't worry, there are more left in there
- I think they're just in the relatively short-lived client programs
6) fix other potential problems, including
- client buffer overflow (if BUFSIZ not big enough)
- struct hostent gets overwritten (mr_connect_internal) by hes_*
on MIT's hesiod/resolver library under certain circumstances
(the recommenedation is to save the value away anyhow)
- usage info skipped lines on 80-col NT consoles
7) add support for hard-coded port default for mr_connect() when services
file and hesiod are unavailable (just for moira_db).
I'd like to get these changes in ASAP as the Pismere team needs to start
working off the moiradev repository (for operational happiness).
I'd prefer to get the changes in now if they do not create problems
and then tweak them to make them a little nicer if people have some
concerns which are not high priority.
Btw, the code builds and runs on Sun & Irix. I tried a few of the
client programs and everything looked ok. (Again, is there a test
suite or scripts, by any chance?)
I also need clients/passwd to be split up. A structure of the form:
clients/chfn
clients/chpobox
clients/chsh
would probably be a good way to go to maintain the current
easy-to-navigate structure of the clients dir.
Once that is all done, I will need to add a directory to store two awk
scripts (and Makefile.src) we use to build the .et files for Moira
(compile_et is much more trouble than it's worth for us to build).
Bob suggested moira/lib/et. Alternatively, we could put the scripts
in moira/util/et and put the Makefile.src in moira/include.
FYI, the Pismere build will use Makefile.src & Makefile.dir files
which will need to be kept in sync with the Makefile.in files.
However, their structure is so simple, it will be difficult to keep
them out of sync.
So, there are 3 things I need:
1) check in changes
2) split clients/passwd
3) add Makefile.dir and Makefile.src files plus
1 & 2 can move in any order. I'll submit 3 when 1 & 2 are done. I'd
like to have the moiradev repository as part of our operations before
next week.
- Danilo
--- START OF PATCH ---
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 -w -r1.15 addusr.c
*** clients/addusr/addusr.c 1999/12/30 17:30:27 1.15
--- clients/addusr/addusr.c 2000/03/02 23:16:55
***************
*** 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 -w -r1.44 blanche.c
*** clients/blanche/blanche.c 2000/01/07 21:14:12 1.44
--- clients/blanche/blanche.c 2000/03/02 23:17:28
***************
*** 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 -w -r1.3 pobox.c
*** clients/lib/pobox.c 2000/02/22 17:45:50 1.3
--- clients/lib/pobox.c 2000/03/02 05:27:48
***************
*** 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 -w -r1.45 mailmaint.c
*** clients/mailmaint/mailmaint.c 1999/12/30 17:30:34 1.45
--- clients/mailmaint/mailmaint.c 2000/03/02 21:45:58
***************
*** 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>
+ #ifndef _WIN32
#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);
***************
*** 148,153 ****
--- 177,183 ----
if (mrcl_connect(NULL, "mailmaint", 2, 1))
exit(2);
+
initscr();
if ((LINES < 24) || (COLS < 60))
{
***************
*** 159,169 ****
--- 189,201 ----
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 ****
--- 203,228 ----
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)
--- 243,249 ----
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]--;
--- 297,308 ----
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 ****
--- 319,343 ----
}
}
}
+ #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 ****
--- 383,389 ----
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++;
--- 391,404 ----
void display_buff(char *buf)
{
int i, cnt;
! char *printbuf = NULL;
int maxcol;
maxcol = COLS;
cnt = 0;
printbuf = calloc(maxcol, 1);
! for (i = 0; i <= (int)strlen(buf); i++)
{
printbuf[cnt] = buf[i];
cnt++;
***************
*** 340,347 ****
if (strlen(buf) % maxcol != 0)
{
start_display_buff(printbuf);
- free(printbuf);
}
return;
}
--- 413,421 ----
if (strlen(buf) % maxcol != 0)
{
start_display_buff(printbuf);
}
+ if (printbuf)
+ free(printbuf);
return;
}
***************
*** 404,409 ****
--- 478,484 ----
show_text(DISPROW + 4, STARTCOL, "Press any Key to continue...");
getchar();
}
+ free(buf);
clrwin(DISPROW);
}
***************
*** 434,440 ****
--- 509,519 ----
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 ****
--- 539,545 ----
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);
--- 548,554 ----
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);
}
/****************************************************/
--- 637,650 ----
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;
--- 680,686 ----
erase_line(currow, STARTCOL);
show_text(currow, STARTCOL, "Flushing query...");
moreflg = 1;
! goto cleanup;
}
clrwin(DISPROW + 2);
currow = DISPROW + 2;
***************
*** 616,621 ****
--- 698,705 ----
currow++;
}
toggle = !toggle;
+ cleanup:
+ free(buffer);
}
/****************************************************/
***************
*** 637,642 ****
--- 721,727 ----
show_text(currow, STARTCOL, "Press any key to continue...");
getchar();
clrwin(DISPROW);
+ free(buffer);
}
/****************************************************/
***************
*** 692,697 ****
--- 777,783 ----
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 ****
--- 796,812 ----
}
/****************************************************/
+ 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'):
--- 940,950 ----
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)
{
--- 969,990 ----
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 -w -r1.1 acl.c
*** clients/moira/acl.c 2000/01/07 21:14:04 1.1
--- clients/moira/acl.c 2000/03/02 09:33:42
***************
*** 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 -w -r1.48 attach.c
*** clients/moira/attach.c 1999/04/30 17:41:06 1.48
--- clients/moira/attach.c 2000/03/02 21:17:12
***************
*** 28,34 ****
--- 28,36 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifndef _WIN32
#include <unistd.h>
+ #endif /* _WIN32 */
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 -w -r1.38 cluster.c
*** clients/moira/cluster.c 1999/04/30 17:41:07 1.38
--- clients/moira/cluster.c 2000/03/03 00:22:53
***************
*** 23,33 ****
#include "globals.h"
#include <sys/types.h>
- #include <sys/utsname.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <ctype.h>
#include <stdio.h>
--- 23,35 ----
#include "globals.h"
#include <sys/types.h>
+ #ifndef _WIN32
+ #include <sys/utsname.h>
#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;
--- 586,592 ----
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;
--- 602,608 ----
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);
--- 999,1014 ----
else
{
struct hostent *hp;
+ #ifndef _WIN32
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 /* _WIN32 */
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 -w -r1.38 lists.c
*** clients/moira/lists.c 2000/01/07 21:14:05 1.38
--- clients/moira/lists.c 2000/03/02 09:34:58
***************
*** 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 -w -r1.37 main.c
*** clients/moira/main.c 2000/01/28 00:03:23 1.37
--- clients/moira/main.c 2000/03/02 09:29:50
***************
*** 12,17 ****
--- 12,18 ----
* <mit-copyright.h>.
*/
+
#include <mit-copyright.h>
#include <moira.h>
#include <mrclient.h>
***************
*** 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;
--- 20,39 ----
#include "f_defs.h"
#include "globals.h"
#include <signal.h>
#include <stdio.h>
#include <string.h>
+ #ifndef _WIN32
#include <unistd.h>
! #endif /* _WIN32 */
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];
--- 55,61 ----
{
int status;
Menu *menu;
! char **arg;
if (!(program_name = strrchr(argv[0], '/')))
program_name = argv[0];
***************
*** 132,153 ****
* 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;
else if (!strcmp(program_name, "usermaint"))
--- 132,139 ----
* These signals should not be set until just before we fire up the menu
* system.
*/
+ SetHandlers();
if (!strcmp(program_name, "listmaint"))
menu = &list_menu;
else if (!strcmp(program_name, "usermaint"))
***************
*** 205,211 ****
* Returns: doesn't
*/
! static void Signal_Handler(void)
{
Put_message("Signal caught - exiting");
#ifdef HAVE_CURSES
--- 191,197 ----
* 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;
}
--- 203,243 ----
}
! static void CatchInterrupt(int sig)
{
Put_message("Interrupt! Press RETURN to continue");
interrupt = 1;
}
+
+ #ifdef _WIN32
+ static void SetHandlers(void)
+ {
+ signal(SIGTERM, Signal_Handler);
+ #ifdef HAVE_CURSES
+ if (use_menu)
+ signal(SIGINT, Signal_Handler);
+ else
+ #endif
+ signal(SIGINT, CatchInterrupt);
+ }
+ #else
+ 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);
+ }
+ }
+ #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 -w -r1.57 menu.c
*** clients/moira/menu.c 2000/02/21 21:37:19 1.57
--- clients/moira/menu.c 2000/03/03 01:12:26
***************
*** 19,26 ****
--- 19,38 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifndef _WIN32
#include <unistd.h>
+ #endif /* _WIN32 */
+ #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 $");
#ifdef MAX
***************
*** 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)))
+ strcat(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 -w -r1.11 misc.c
*** clients/moira/misc.c 1998/10/22 18:29:35 1.11
--- clients/moira/misc.c 2000/03/02 06:20:00
***************
*** 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 -w -r1.33 pobox.c
*** clients/moira/pobox.c 2000/02/18 17:07:58 1.33
--- clients/moira/pobox.c 2000/03/02 05:38:36
***************
*** 395,404 ****
{
int status;
char *type, temp_buf[BUFSIZ], *local_user, *args[10], *box;
- char *temp_box;
struct mqelem *top = NULL;
-
local_user = argv[1];
if (!ValidName(local_user))
return DM_NORMAL;
--- 395,403 ----
{
int status;
char *type, temp_buf[BUFSIZ], *local_user, *args[10], *box;
struct mqelem *top = NULL;
local_user = argv[1];
+
if (!ValidName(local_user))
return DM_NORMAL;
***************
*** 438,443 ****
--- 437,443 ----
sprintf(temp_buf, "%s did not have a previous local PO Box.",
local_user);
Put_message(temp_buf);
+
default:
com_err(program_name, status, " in set_pobox_pop.");
return DM_NORMAL;
***************
*** 547,552 ****
--- 547,553 ----
return DM_NORMAL;
}
+
/* Function Name: RemoveUserPOBox
* Description: Removes this users POBox.
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 -w -r1.26 printer.c
*** clients/moira/printer.c 1999/08/04 14:58:08 1.26
--- clients/moira/printer.c 2000/03/02 05:39:52
***************
*** 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.55
diff -c -w -r1.55 user.c
*** clients/moira/user.c 2000/01/28 00:03:24 1.55
--- clients/moira/user.c 2000/03/02 09:31:41
***************
*** 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 -w -r1.46 utils.c
*** clients/moira/utils.c 2000/01/26 18:04:53 1.46
--- clients/moira/utils.c 2000/03/02 22:06:08
***************
*** 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 -w -r1.18 mrcheck.c
*** clients/mrcheck/mrcheck.c 1999/12/30 17:30:36 1.18
--- clients/mrcheck/mrcheck.c 2000/03/02 22:18:52
***************
*** 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 -w -r1.48 mrtest.c
*** clients/mrtest/mrtest.c 1999/12/30 17:30:37 1.48
--- clients/mrtest/mrtest.c 2000/03/02 22:32:57
***************
*** 6,12 ****
* For copying and distribution information, please see the file
* <mit-copyright.h>.
*/
-
#include <mit-copyright.h>
#include <moira.h>
--- 6,11 ----
***************
*** 17,23 ****
--- 16,36 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifndef _WIN32
#include <unistd.h>
+ #else
+ #include <windows.h>
+ #include <io.h>
+ #include <getopt.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"
***************
*** 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]);
--- 42,53 ----
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];
--- 65,76 ----
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)
--- 98,104 ----
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);
--- 111,117 ----
exit(0);
}
! void discard_input(int sig)
{
putc('\n', stdout);
***************
*** 111,116 ****
--- 123,129 ----
siglongjmp(jb, 1);
}
+
char *mr_gets(char *prompt, char *buf, size_t len)
{
char *in;
***************
*** 432,438 ****
void test_query(int argc, char **argv)
{
int status, help;
- sigset_t sigs;
if (argc < 2)
{
--- 445,450 ----
***************
*** 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, "");
--- 456,464 ----
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 ****
--- 530,571 ----
if (status)
com_err("moira (version)", status, "");
}
+
+ #ifndef _WIN32
+
+ 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);
+ }
+
+ BOOL WINAPI blocking_handler(DWORD dwCtrlType)
+ {
+ return(TRUE);
+ }
+
+ void set_signal_blocking(int sig, int block)
+ {
+ SetConsoleCtrlHandler(blocking_handler, block ? TRUE : FALSE);
+ }
+
+ #endif /* _WIN32 */
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 -w -r1.20 chfn.c
*** clients/passwd/chfn.c 1999/12/30 17:30:37 1.20
--- clients/passwd/chfn.c 2000/03/02 22:36:34
***************
*** 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 -w -r1.28 chpobox.c
*** clients/passwd/chpobox.c 2000/01/28 00:31:55 1.28
--- clients/passwd/chpobox.c 2000/03/02 09:39:24
***************
*** 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,39 ----
#include <moira_site.h>
#include <mrclient.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #ifndef _WIN32
#include <unistd.h>
+ #else
+ #include <getopt.h>
+ #endif /* _WIN32 */
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;
--- 46,51 ----
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 -w -r1.1 stella.c
*** clients/stella/stella.c 2000/02/10 05:33:44 1.1
--- clients/stella/stella.c 2000/03/02 22:38:42
***************
*** 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 -w -r1.27 moira.h
*** include/moira.h 2000/01/28 00:03:27 1.27
--- include/moira.h 2000/03/02 23:15:41
***************
*** 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 -w -r1.22 fixhost.c
*** lib/fixhost.c 1999/12/14 20:43:58 1.22
--- lib/fixhost.c 2000/03/03 00:24:53
***************
*** 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,23 ----
#include <moira.h>
#include <sys/types.h>
+
+ #ifndef _WIN32
#include <sys/socket.h>
#include <sys/utsname.h>
#include <netdb.h>
#include <netinet/in.h>
+ #endif /* _WIN32 */
#include <ctype.h>
#include <stdio.h>
***************
*** 24,29 ****
--- 26,45 ----
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 _WIN32
+ char hostname[128];
+ gethostname(hostname, sizeof(hostname));
+ hostname[sizeof(hostname)-1] = 0;
+ return gethostbyname(hostname);
+ #else
+ struct utsname name;
+ uname(&name);
+ return gethostbyname(name.nodename);
+ #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, '.');
--- 58,64 ----
}
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 -w -r1.17 mr_call.c
*** lib/mr_call.c 2000/01/31 15:44:16 1.17
--- lib/mr_call.c 2000/03/02 09:36:30
***************
*** 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,23 ----
#include "mr_private.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+ #ifndef _WIN32
+ #include <netinet/in.h>
#include <unistd.h>
+ #endif /* _WIN32 */
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;
--- 55,62 ----
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;
--- 102,113 ----
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;
--- 130,140 ----
* 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);
--- 142,148 ----
{
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);
--- 159,166 ----
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;
--- 181,187 ----
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 -w -r1.32 mr_connect.c
*** lib/mr_connect.c 2000/02/16 18:12:10 1.32
--- lib/mr_connect.c 2000/03/03 00:02:03
***************
*** 14,28 ****
#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>
--- 14,36 ----
#include "mr_private.h"
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+
+ #ifndef _WIN32
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
#include <unistd.h>
+ #ifndef closesocket
+ #define closesocket close
+ #endif
+ #ifndef SOCKET_ERROR
+ #define SOCKET_ERROR -1
+ #endif
+ #endif
#ifdef HAVE_HESIOD
#include <hesiod.h>
***************
*** 30,35 ****
--- 38,46 ----
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;
}
--- 130,209 ----
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;
--- 211,217 ----
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;
}
--- 273,289 ----
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);
--- 326,334 ----
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;
}
--- 337,343 ----
*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;
}
--- 348,358 ----
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;
}
--- 364,370 ----
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;
--- 372,380 ----
/* 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 -w -r1.12 mr_private.h
*** lib/mr_private.h 1998/07/15 20:39:32 1.12
--- lib/mr_private.h 2000/03/02 07:59:34
***************
*** 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);
Index: util/et/error_message.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/util/et/error_message.c,v
retrieving revision 1.2
diff -c -w -r1.2 error_message.c
*** util/et/error_message.c 1998/02/05 22:13:07 1.2
--- util/et/error_message.c 2000/03/02 04:08:12
***************
*** 11,20 ****
#include <stdio.h>
#include <string.h>
#include "error_table.h"
#include "mit-sipb-copyright.h"
! static const char rcsid[] = "$Id: error_message.c,v 1.2 1998/02/05 22:13:07 danw Exp $";
static const char copyright[] =
"Copyright 1986, 1987, 1988 by the Student Information Processing Board\nand the department of Information Systems\nof the Massachusetts Institute of Technology";
--- 11,22 ----
#include <stdio.h>
#include <string.h>
+
+ #include "com_err.h"
#include "error_table.h"
#include "mit-sipb-copyright.h"
! static const char rcsid[] = "$Id: error_message.c,v 1.1.1.2 1999/10/21 16:31:28 dtanner Exp $";
static const char copyright[] =
"Copyright 1986, 1987, 1988 by the Student Information Processing Board\nand the department of Information Systems\nof the Massachusetts Institute of Technology";
--- END OF PATCH ---