Commit f7e30197 authored by Leigh Stoller's avatar Leigh Stoller

Minor change. Instead of returning "wheel" for the default group when

a node is not allocated (thus putting the .acl and .run file into the
wheel group when capture creates them), return the value of the config
variable TBADMINGROUP (which is flux for us). This makes it easier for
admin people to look at free nodes.
parent 5750763f
......@@ -9,7 +9,7 @@ all: capture capserver capture-tty
include $(TESTBED_SRCDIR)/GNUmakerules
DBFLAGS += -DTBDBNAME='"$(TBDBNAME)"' -I/usr/local/include
DBFLAGS += -I/usr/local/include
DESTDIR=
......@@ -17,10 +17,10 @@ DESTDIR=
# Define LOG_DROPS to record warnings in syslog whenever chars were dropped
# due to the output device/pty being full.
#
CFLAGS= -g -O2 -DLOG_DROPS
CFLAGS= -g -O2 -DLOG_DROPS -I${OBJDIR}
capture: capture.c capdecls.h
cc $(CFLAGS) -DUSESOCKETS -DBOSSNODE='"$(BOSSNODE)"' -o capture $<
cc $(CFLAGS) -DUSESOCKETS -o capture $<
capture-tty: capture.c capdecls.h
cc $(CFLAGS) -o capture-tty $<
......
......@@ -23,7 +23,9 @@
#include <stdarg.h>
#include <mysql/mysql.h>
#include <sys/time.h>
#include <grp.h>
#include "capdecls.h"
#include "config.h"
#define TESTMODE
......@@ -34,6 +36,7 @@
static int debug = 0;
static int portnum = SERVERPORT;
static char *dbname = DEFAULT_DBNAME;
static gid_t admingid;
MYSQL_RES * mydb_query(char *query, int ncols, ...);
int mydb_update(char *query, ...);
......@@ -59,6 +62,7 @@ main(int argc, char **argv)
int length, i, err = 0;
struct sockaddr_in name;
struct timeval timeout;
struct group *group;
while ((ch = getopt(argc, argv, "dp:")) != -1)
switch(ch) {
......@@ -85,6 +89,15 @@ main(int argc, char **argv)
if (!debug)
(void)daemon(0, 0);
/*
* Grab the GID for the default group.
*/
if ((group = getgrnam(TBADMINGROUP)) == NULL) {
syslog(LOG_ERR, "Getting GID for %s", TBADMINGROUP);
exit(1);
}
admingid = group->gr_gid;
/*
* Setup TCP socket
*/
......@@ -220,7 +233,7 @@ main(int argc, char **argv)
* Default to root/root.
*/
tipown.uid = 0;
tipown.gid = 0;
tipown.gid = admingid;
}
mysql_free_result(res);
......
......@@ -55,6 +55,7 @@
#include <netdb.h>
#endif
#include "capdecls.h"
#include "config.h"
#define geterr(e) strerror(e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment