-.TH SMS 3 "8 Jan 1989"
+.TH MOIRA 3 "8 Jan 1989"
.FM mit
.SH NAME
-sms_connect, sms_host, sms_auth, sms_disconnect, sms_noop, sms_access,
-sms_query, sms_do_update, sms_motd, sms_set_alternate_input,
+mr_connect, mr_host, mr_auth, mr_disconnect, mr_noop, mr_access,
+mr_query, mr_do_update, mr_motd, mr_set_alternate_input,
format_filesys_type, parse_filesys_type,
canonicalize_hostname, strsave, strtrim, sq_create, sq_destroy,
sq_get_data, sq_remove_data, sq_empty, sq_save_args, sq_save_data,
.nj
.TP
Protocol functions
-.B #include <sms.h>
+.B #include <moira.h>
-.B int sms_connect(server);
+.B int mr_connect(server);
.B char *server;
-.B int sms_host(host, size);
+.B int mr_host(host, size);
.B char *server;
-.B int sms_motd(motd);
+.B int mr_motd(motd);
.B char **motd;
-.B int sms_auth(prog);
+.B int mr_auth(prog);
.B char *prog;
-.B int sms_disconnect();
+.B int mr_disconnect();
-.B int sms_noop();
+.B int mr_noop();
-.B int sms_access(name, argc, argv);
+.B int mr_access(name, argc, argv);
.B char *name;
.B int argc;
.B char **argv;
-.B int sms_query(name, argc, argv, callproc, callarg);
+.B int mr_query(name, argc, argv, callproc, callarg);
.B char *name;
.B int argc;
.B char **argv;
.B int (*callproc)(int, char **, char *);
.B char *callarg;
-.B int sms_do_update();
+.B int mr_do_update();
-.B int sms_set_alternate_input(fd, proc)
+.B int mr_set_alternate_input(fd, proc)
.B int fd;
.B void (*proc)();
.TP
directly. Instead, they are called by the routines that are described.
Be sure to link your application against these libraries:
--lsms -lsmsgdb -lcom_err -lkrb -ldes
+-lmoira -lmrgdb -lcom_err -lkrb -ldes
.TP
Protocol functions
All protocol routines return 0 on success, or a value from
-.I <sms_et.h>
+.I <mr_et.h>
on failure. An application should connect, check the motd in case the
server is closed, authenticate, perform queries, then disconnect.
-.B sms_connect
-establishes a connection with the SMS server. The
+.B mr_connect
+establishes a connection with the Moira server. The
.I server
specification is optional. If present, it is of the form
hostname:portname, where the portname can be looked up in
variable, the "moira" sloc entry in hesiod, or the compiled in
default, in that order.
-.B sms_host
+.B mr_host
initializes
.I host
with the name of the host that the client is currently connected to.
-.B sms_motd
+.B mr_motd
will check to see if the server is closed and if so, will retrieve an
explanatory message (the so-called motd). This routine will always
return 0 if no error occurs. *motd will be NULL if the server is
functioning normally, or a pointer to a static string with the
explanation if the server is down.
-.B sms_auth
+.B mr_auth
authenticates an established connection using Kerberos.
.I prog
is the name of the program making the connection. The program name
and the kerberos principal name will be recorded with any changes made
to the database through this connection.
-.B sms_disconnect
-severs the connection with the SMS server.
+.B mr_disconnect
+severs the connection with the Moira server.
-.B sms_noop
-pings the SMS server through a "no operation" request, verifying that
+.B mr_noop
+pings the Moira server through a "no operation" request, verifying that
the connection is still working.
-.B sms_access
+.B mr_access
Verifies that the authenticated user has the necessary access to
perform the query specified by
.I name, argc,
and
.I argv.
-.B sms_query
+.B mr_query
performs a query. This query may be a retrieval, append, delete, or
update of the database. Query
.I name
will be called with an
.I argc, argv,
and the value passed to
-.B sms_query
+.B mr_query
as
.I callarg.
-.B sms_do_update
-triggers a DCM update immediately on the SMS server.
+.B mr_do_update
+triggers a DCM update immediately on the Moira server.
-.B sms_set_alternate_input
+.B mr_set_alternate_input
tells the Moira library that you want to allow some asynchronus
actions while a query is being processed. During query processing, if
any data is available to be read on the specified file descriptor,
then the specified function will be called to handle it. For
-instance, calling sms_set_alternate_input with the connection to the X
+instance, calling mr_set_alternate_input with the connection to the X
server and a routine which will dispatch X events will allow a toolkit
application to handle mouse and expose events while a query is being
processed.
except that it uses strcmp on the elements rather than comparing the
addresses directly.
.SH FILES
-/usr/include/sms.h
+/usr/include/moira.h
.br
-/usr/include/sms_et.h
+/usr/include/mr_et.h
.br
/tmp/tkt###
.SH "SEE ALSO"
mrtest(8), The Moira section of the Athena Technical Plan
.SH DIAGNOSTICS
-The error codes returned are those defined in <sms_et.h>, or
+The error codes returned are those defined in <mr_et.h>, or
<krb_et.h>. They may be easily decoded using the com_err library.
.SH RESTRICTIONS
COPYRIGHT 1987,1988,1989 Massachusetts Institute of Technology
CSRCS= client.c ticket.c send_file.c checksum.c hostname.c
-LIBS= -L../lib -lsms -lgdb -lkrb -ldes -lcom_err
+LIBS= -L../lib -lmoira -lgdb -lkrb -ldes -lcom_err
-all: sms_update.o update_server sms_untar
+all: moira_update.o update_server sms_untar
update_server: ${SOBJS}
cc ${CFLAGS} -o update_server ${SOBJS} ${LIBS}
-sms_update.o: ${COBJS}
- ld -r -o sms_update.o ${COBJS}
+moira_update.o: ${COBJS}
+ ld -r -o moira_update.o ${COBJS}
sms_untar: sms_untar.c
cc -o sms_untar ${INCS} sms_untar.c
clean:
-rm -f ${COBJS} ${SOBJS}
- -rm -f update_server sms_update.o
+ -rm -f update_server moira_update.o
-rm -f sms_untar
-rm -f core a.out *~ \#*
lint ${LINTFLAGS} ${SSRCS}
lint ${LINTFLAGS} ${CSRCS}
-
smskey: smskey.c
${CC} ${CFLAGS} -o smskey smskey.c -ldes
update_server.o: /usr/include/stdio.h ../include/gdb.h
update_server.o: /usr/include/sys/types.h /usr/include/sys/time.h
update_server.o: /usr/include/sys/time.h /usr/include/errno.h
-update_server.o: /usr/include/strings.h ../include/sms.h ../include/sms_et.h
+update_server.o: /usr/include/strings.h ../include/moira.h ../include/mr_et.h
update_server.o: /usr/include/sys/file.h /usr/include/sys/ioctl.h
update_server.o: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
update_server.o: ../include/update.h
xfer_002.o: /usr/include/sys/time.h /usr/include/ctype.h
xfer_002.o: /usr/include/sys/param.h /usr/include/machine/machparam.h
xfer_002.o: /usr/include/sys/signal.h /usr/include/sys/file.h
-xfer_002.o: /usr/include/strings.h ../include/sms.h ../include/sms_et.h
+xfer_002.o: /usr/include/strings.h ../include/moira.h ../include/mr_et.h
exec_002.o: exec_002.c ../include/mit-copyright.h /usr/include/stdio.h
exec_002.o: /usr/include/sys/wait.h /usr/include/sys/signal.h
exec_002.o: ../include/gdb.h /usr/include/sys/types.h /usr/include/sys/time.h
-exec_002.o: /usr/include/sys/time.h ../include/sms.h ../include/sms_et.h
+exec_002.o: /usr/include/sys/time.h ../include/moira.h ../include/mr_et.h
exec_002.o: ../include/update.h
hostname.o: hostname.c ../include/mit-copyright.h /usr/include/stdio.h
hostname.o: /usr/include/sys/types.h /usr/include/netinet/in.h
get_file.o: /usr/include/sys/time.h /usr/include/ctype.h
get_file.o: /usr/include/sys/param.h /usr/include/machine/machparam.h
get_file.o: /usr/include/sys/signal.h /usr/include/sys/file.h
-get_file.o: ../include/sms.h ../include/sms_et.h ../include/update.h
+get_file.o: ../include/moira.h ../include/mr_et.h ../include/update.h
checksum.o: checksum.c ../include/mit-copyright.h /usr/include/stdio.h
checksum.o: /usr/include/sys/file.h
client.o: client.c ../include/mit-copyright.h /usr/include/stdio.h
client.o: /usr/include/sys/param.h /usr/include/machine/machparam.h
client.o: /usr/include/sys/signal.h /usr/include/sys/wait.h
client.o: /usr/include/sys/socket.h ../include/update.h /usr/include/errno.h
-client.o: ../include/dcm.h ../include/sms.h ../include/sms_et.h
-client.o: ../include/sms_app.h ../include/krb.h ../include/des.h
+client.o: ../include/dcm.h ../include/moira.h ../include/mr_et.h
+client.o: ../include/moira_site.h ../include/krb.h ../include/des.h
ticket.o: ticket.c ../include/mit-copyright.h /usr/include/stdio.h
ticket.o: ../include/krb.h ../include/des.h /usr/include/sys/types.h
ticket.o: /usr/include/sys/stat.h /usr/include/strings.h ../include/update.h
send_file.o: send_file.c ../include/mit-copyright.h /usr/include/stdio.h
send_file.o: ../include/com_err.h ../include/gdb.h /usr/include/sys/types.h
send_file.o: /usr/include/sys/time.h /usr/include/sys/time.h ../include/dcm.h
-send_file.o: ../include/sms.h ../include/sms_et.h /usr/include/sys/file.h
+send_file.o: ../include/moira.h ../include/mr_et.h /usr/include/sys/file.h
send_file.o: /usr/include/sys/stat.h ../include/update.h
checksum.o: checksum.c ../include/mit-copyright.h /usr/include/stdio.h
checksum.o: /usr/include/sys/file.h
* <mit-copyright.h>.
* DESCRIPTION:
* This code handles the actual distribution of data files
- * to servers in the SMS server-update program.
+ * to servers in the MOIRA server-update program.
* AUTHOR:
* Ken Raeburn (spook@athena.MIT.EDU),
* MIT Project Athena/MIT Information Systems.
* DEFINED VALUES:
* conn
- * sms_update_server
+ * mr_update_server
*/
#include <mit-copyright.h>
#include <update.h>
#include <errno.h>
#include <dcm.h>
-#include <sms.h>
-#include <sms_app.h>
+#include <moira.h>
+#include <moira_site.h>
#include <krb.h>
extern char *malloc();
/*
* FUNCTION:
- * sms_update_server(service, machine, target_path)
+ * mr_update_server(service, machine, target_path)
* DESCRIPTION:
* Attempts to perform an update to the named machine
* of the named service. The file DCM_DIR/service.out
* INPUT:
* service
* Name of service to be updated; used to find
- * the source data file in the SMS data directory.
+ * the source data file in the MR data directory.
* machine
* target_path
* Location to install the file.
*/
int
-sms_update_server(service, machine, target_path, instructions)
+mr_update_server(service, machine, target_path, instructions)
char *service;
char *machine;
char *target_path;
int on;
/* some sanity checking of arguments while we build data */
- ASSERT(NONNULL(machine), SMS_INTERNAL, " null host name");
- ASSERT(NONNULL(service), SMS_INTERNAL, " null service name");
- ASSERT((strlen(machine) + strlen(service) + 2 < BUFSIZ), SMS_ARG_TOO_LONG,
+ ASSERT(NONNULL(machine), MR_INTERNAL, " null host name");
+ ASSERT(NONNULL(service), MR_INTERNAL, " null service name");
+ ASSERT((strlen(machine) + strlen(service) + 2 < BUFSIZ), MR_ARG_TOO_LONG,
" machine and service names");
sprintf(buf, "%s:%s", machine, service);
service_updated = strsave(buf);
- ASSERT(NONNULL(service_updated), SMS_NO_MEM, " for service name");
- ASSERT((strlen(machine)+strlen(SERVICE_NAME)+2 < BUFSIZ), SMS_ARG_TOO_LONG,
+ ASSERT(NONNULL(service_updated), MR_NO_MEM, " for service name");
+ ASSERT((strlen(machine)+strlen(SERVICE_NAME)+2 < BUFSIZ), MR_ARG_TOO_LONG,
" machine and update service name");
sprintf(buf, "%s:%s", machine, SERVICE_NAME);
service_address = strsave(buf);
- ASSERT(NONNULL(service_address), SMS_NO_MEM, " for service address");
- ASSERT(NONNULL(target_path), SMS_INTERNAL, " null target pathname");
- ASSERT((strlen(target_path) < MAXPATHLEN), SMS_ARG_TOO_LONG,
+ ASSERT(NONNULL(service_address), MR_NO_MEM, " for service address");
+ ASSERT(NONNULL(target_path), MR_INTERNAL, " null target pathname");
+ ASSERT((strlen(target_path) < MAXPATHLEN), MR_ARG_TOO_LONG,
" target pathname");
- ASSERT2(target_path[0] == '/', SMS_NOT_UNIQUE,
+ ASSERT2(target_path[0] == '/', MR_NOT_UNIQUE,
" non-absolute pathname supplied \"%s\"", target_path);
sprintf(buf, "%s/%s.out", DCM_DIR, service);
pathname = strsave(buf);
- ASSERT(NONNULL(pathname), SMS_NO_MEM, " for pathname");
- ASSERT(NONNULL(instructions), SMS_NO_MEM, " for instructions");
- ASSERT((strlen(instructions) < MAXPATHLEN), SMS_ARG_TOO_LONG,
+ ASSERT(NONNULL(pathname), MR_NO_MEM, " for pathname");
+ ASSERT(NONNULL(instructions), MR_NO_MEM, " for instructions");
+ ASSERT((strlen(instructions) < MAXPATHLEN), MR_ARG_TOO_LONG,
" instruction pathname");
initialize();
if (!conn || (connection_status(conn) == CON_STOPPED)) {
com_err(whoami, connection_errno(conn),
" can't connect to update %s", service_address);
- return(SMS_CANT_CONNECT);
+ return(MR_CANT_CONNECT);
}
on = 1;
setsockopt(conn->in.fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
goto update_failed;
/* send instructions for installation */
- strcpy(buf, "/tmp/sms-update.XXXXXX");
+ strcpy(buf, "/tmp/moira-update.XXXXXX");
mktemp(buf);
code = send_file(instructions, buf);
if (code)
}
/* finished updates */
- code = SMS_SUCCESS;
+ code = MR_SUCCESS;
update_failed:
send_quit();
register int code;
int response;
- code = get_sms_update_ticket(host_name, ticket);
+ code = get_mr_update_ticket(host_name, ticket);
if (code) {
return(code);
}
if (response) {
return(response);
}
- return(SMS_SUCCESS);
+ return(MR_SUCCESS);
}
static
com_err(whoami, response, "execute returned %d", response);
if (response)
return(response);
- return(SMS_SUCCESS);
+ return(MR_SUCCESS);
}
send_quit()
#include <sys/wait.h>
#include <signal.h>
#include <gdb.h>
-#include <sms.h>
+#include <moira.h>
#include "update.h"
extern CONNECTION conn;
#include <ctype.h>
#include <sys/param.h>
#include <sys/file.h>
-#include <sms.h>
+#include <moira.h>
#include "update.h"
extern CONNECTION conn;
int found_checksum;
if (!have_authorization) {
- reject_call(SMS_PERM);
+ reject_call(MR_PERM);
return(1);
}
if (done) /* re-initialize data */
code = errno;
sprintf(buf, "%s: creating file %s (get_file)",
error_message(code), pathname);
- sms_log_error(buf);
+ mr_log_error(buf);
report_error("reporting file creation error (get_file)");
return(1);
}
code = errno;
sprintf(buf, "%s: verifying free disk space for %s (get_file)",
error_message(code), pathname);
- sms_log_error(buf);
+ mr_log_error(buf);
/* do all we can to free the space */
(void) unlink(pathname);
(void) ftruncate(fd, 0);
/* validate checksum */
found_checksum = checksum_file(pathname);
if (checksum != found_checksum) {
- code = SMS_MISSINGFILE;
+ code = MR_MISSINGFILE;
com_err(whoami, code, ": expected = %d, found = %d",
checksum, found_checksum);
report_error("checksum error");
if (n_wrote == -1) {
code = errno;
sprintf(buf, "%s: writing file (get_file)", error_message(code));
- sms_log_error(buf);
+ mr_log_error(buf);
string_free(&data);
report_error("reporting write error (get_file)");
close(fd);
int log_priority;
extern char *whoami;
-void sms_update_com_err_hook(whoami, code, fmt, args)
+void mr_update_com_err_hook(whoami, code, fmt, args)
const char *whoami;
long code;
const char *fmt;
va_list args;
{
char buf[BUFSIZ], *cp;
+#ifndef __STDC__
FILE _strbuf;
+#endif
#ifndef use_syslog
strcpy(buf, whoami);
while (*cp)
cp++;
}
+#ifdef __STDC__
+ vsprintf(cp, fmt, args);
+#else
_strbuf._flag = _IOWRT+_IOSTRG;
_strbuf._ptr = cp;
_strbuf._cnt = BUFSIZ-(cp-buf);
_doprnt(fmt, args, &_strbuf);
putc('\0', &_strbuf);
+#endif
#ifdef use_syslog
syslog(syslog_prio[log_priority], "%s", buf);
#endif
#endif
}
-sms_update_initialize()
+mr_update_initialize()
{
static int initialized = 0;
if (initialized)
#ifdef use_syslog
openlog(whoami, LOG_PID, LOG_DAEMON);
#endif
- (void) set_com_err_hook(sms_update_com_err_hook);
+ (void) set_com_err_hook(mr_update_com_err_hook);
log_priority = log_INFO;
initialized = 1;
}
{\
register int old_prio; \
old_prio = log_priority; \
- sms_update_initialize(); \
+ mr_update_initialize(); \
com_err(whoami, 0, fmt, level, msg); \
log_priority = old_prio; \
}
-def(sms_log_error, "error", log_ERROR)
-def(sms_log_warning, "warning", log_WARNING)
-def(sms_log_info, "info", log_INFO)
-def(sms_debug, "debug", log_DEBUG)
+def(mr_log_error, "error", log_ERROR)
+def(mr_log_warning, "warning", log_WARNING)
+def(mr_log_info, "info", log_INFO)
+def(mr_debug, "debug", log_DEBUG)
#include <com_err.h>
#include <gdb.h>
#include <dcm.h>
-#include <sms.h>
+#include <moira.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <update.h>
fd = open(pathname, O_RDONLY, 0);
if (fd < 0) {
com_err(whoami, errno, "unable to open %s for read", pathname);
- return(SMS_OCONFIG);
+ return(MR_OCONFIG);
}
if (fstat(fd, &statb)) {
com_err(whoami, errno, "unable to stat %s", pathname);
close(fd);
- return(SMS_OCONFIG);
+ return(MR_OCONFIG);
}
n_to_send = statb.st_size;
if (n < 0) {
com_err(whoami, errno, " reading %s for transmission", pathname);
close(fd);
- return(SMS_ABORTED);
+ return(MR_ABORTED);
}
MAX_STRING_SIZE(data) = n;
code = send_object(conn, (char *)&data, STRING_T);
}
}
close(fd);
- return(SMS_SUCCESS);
+ return(MR_SUCCESS);
}
int
-get_sms_update_ticket(host, ticket)
+get_mr_update_ticket(host, ticket)
char *host;
KTEXT ticket;
{
code += ERROR_TABLE_BASE_krb;
if (pass == 1) {
/* maybe we're taking too long? */
- if ((code = get_sms_tgt()) != 0) {
+ if ((code = get_mr_tgt()) != 0) {
/* don't need phost buffer any more */
com_err(whoami, code, " can't get Kerberos TGT");
return(code);
}
int
-get_sms_tgt()
+get_mr_tgt()
{
register int code;
init();
#include <gdb.h>
#include <errno.h>
#include <strings.h>
-#include <sms.h>
+#include <moira.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include "update.h"
char *fmt;
{
sprintf(buf, fmt, error_message(code));
- sms_log_error(buf);
+ mr_log_error(buf);
}
main(argc, argv)
umask(0022);
initialize_sms_error_table();
initialize_krb_error_table();
- sms_update_initialize();
+ mr_update_initialize();
/* wait for connection */
gdb_init();
exit(1);
}
- sms_log_info("got connection");
+ mr_log_info("got connection");
/* got a connection; loop forever */
while (1) {
register char *cp;
}
}
sprintf(buf, "unknown request received: %s\n", STRING_DATA(str));
- sms_log_error(buf);
- code = send_int(SMS_UNKNOWN_PROC);
+ mr_log_error(buf);
+ code = send_int(MR_UNKNOWN_PROC);
if (code) {
err(connection_errno(conn), "%s: sending UNKNOWN_PROC");
}
* any arguments are ignored
*
* function:
- * closes connection from SMS
+ * closes connection from MR
*/
int
quit(str)
#endif /* lint */
(void) send_ok();
sever_connection(conn);
- sms_log_info("Closing connection.");
+ mr_log_info("Closing connection.");
exit(0);
}
char *msg;
{
sprintf(buf, "%s: %s", error_message(code), msg);
- sms_log_error(buf);
+ mr_log_error(buf);
if (conn)
sever_connection(conn);
exit(1);
#include <sys/param.h>
#include <sys/file.h>
#include <strings.h>
-#include <sms.h>
+#include <moira.h>
extern CONNECTION conn;
char buf[BUFSIZ];
*
* function:
* perform initial preparations and receive file as
- * a single string, storing it into <pathname>.sms_update.
+ * a single string, storing it into <pathname>.moira_update.
*
* still to be done: file locking; perform transfers in pieces instead
* of all at once; use checksums
str++;
if (!*str) {
failure:
- reject_call(SMS_ARGS);
+ reject_call(MR_ARGS);
return;
}
file_size = atoi(str);
goto failure;
pathname = str;
if (!have_authorization) {
- reject_call(SMS_PERM);
+ reject_call(MR_PERM);
return;
}
if (done) /* re-initialize data */
have_file = 1;
strcpy(buf, "transferred file ");
strcat(buf, pathname);
- sms_log_info(buf);
+ mr_log_info(buf);
}
return;
}