Commit bab97a0c authored by Leigh B Stoller's avatar Leigh B Stoller

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 6231f84d 1e241319
#!/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
use warnings;
......
#!/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
use Data::Dumper;
use POSIX 'strftime','mktime';
......
#!/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......
#!/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......
#!/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
use warnings;
......
#!/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
use warnings;
use POSIX qw(strftime);
......
#!/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
cd @prefix@/data/node_usage/
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
set -e
......
#/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
use Data::Dumper;
......
......@@ -41,7 +41,6 @@ CREATE TABLE `geni_authorities` (
`url` tinytext,
`urn` tinytext,
PRIMARY KEY (`uuid`),
UNIQUE KEY `hrn` (`hrn`)
UNIQUE KEY `urn` (`urn`(256))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
......@@ -15,6 +15,7 @@
from urlparse import urlsplit, urlunsplit
from urllib import splitport
import xmlrpclib
import M2Crypto
from M2Crypto import X509
import socket
......@@ -237,6 +238,14 @@ def do_method(module, method, params, URI=None, quiet=False, version=None):
except xmlrpclib.ProtocolError, e:
if not quiet: print >> sys.stderr, e.errmsg
return (-1, None)
except M2Crypto.SSL.Checker.WrongHost, e:
if not quiet:
print >> sys.stderr, "Warning: certificate host name mismatch."
print >> sys.stderr, "Please consult:"
print >> sys.stderr, " http://www.protogeni.net/trac/protogeni/wiki/HostNameMismatch"
print >> sys.stderr, "for recommended solutions."
print >> sys.stderr, e
return (-1, None)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
......
......@@ -73,6 +73,11 @@
#define XSTRINGIFY(s) STRINGIFY(s)
#define STRINGIFY(s) #s
/* XXX backward compat */
#ifndef TBCOREDIR
#define TBCOREDIR TBROOT "/tmp"
#endif
/* socket read/write timeouts in ms */
#define READTIMO 3000
#define WRITETIMO 3000
......@@ -497,7 +502,11 @@ main(int argc, char **argv)
loginit(0, 0);
else {
/* Become a daemon */
daemon(0, 0);
if (chdir(TBCOREDIR)) {
daemon(0, 0);
} else {
daemon(1, 0);
}
loginit(1, "tmcd");
}
info("daemon starting (version %d)\n", CURRENT_VERSION);
......@@ -4476,7 +4485,8 @@ mydb_query(char *query, int ncols, ...)
va_start(ap, ncols);
n = vsnprintf(querybuf, sizeof(querybuf), query, ap);
if (n > sizeof(querybuf)) {
va_end(ap);
if (n >= sizeof(querybuf)) {
error("query too long for buffer\n");
return (MYSQL_RES *) 0;
}
......@@ -4532,7 +4542,8 @@ mydb_update(char *query, ...)
va_start(ap, query);
n = vsnprintf(querybuf, sizeof(querybuf), query, ap);
if (n > sizeof(querybuf)) {
va_end(ap);
if (n >= sizeof(querybuf)) {
error("query too long for buffer\n");
return 1;
}
......@@ -4768,7 +4779,14 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey)
if (row[4] && row[5]) {
strncpy(reqp->pid, row[4], sizeof(reqp->pid));
strncpy(reqp->eid, row[5], sizeof(reqp->eid));
reqp->exptidx = atoi(row[25]);
if (row[25])
reqp->exptidx = atoi(row[25]);
else {
error("iptonodeid: %s: in non-existent experiment %s/%s!\n",
inet_ntoa(ipaddr), reqp->pid, reqp->eid);
mysql_free_result(res);
return 1;
}
reqp->allocated = 1;
if (row[6])
......@@ -8192,16 +8210,15 @@ COMMAND_PROTOTYPE(dotpmblob)
"where node_id='%s' ",
1, reqp->nodeid);
if (!res){
if (!res) {
error("gettpmblob: %s: DB error getting tpmblob\n",
reqp->nodeid);
reqp->nodeid);
return 1;
}
nrows = mysql_num_rows(res);
if (!nrows){
error("%s: no tpmblob in database for this node.\n",
if (!nrows) {
error("%s: no node_hostkeys info in the database!\n",
reqp->nodeid);
mysql_free_result(res);
return 1;
......@@ -8209,23 +8226,25 @@ COMMAND_PROTOTYPE(dotpmblob)
row = mysql_fetch_row(res);
nlen = mysql_fetch_lengths(res);
if (!nlen || !nlen[0]){
error("%s: invalid blob length.\n",
reqp->nodeid);
if (!nlen || !nlen[0]) {
mysql_free_result(res);
#if 0 /* not an error yet */
error("%s: no TPM blob.\n", reqp->nodeid);
return 1;
#endif
return 0;
}
bufp += OUTPUT(bufp, bufe - bufp,
(hex ? "BLOBHEX=" : "BLOB="));
if (hex){
(hex ? "BLOBHEX=" : "BLOB="));
if (hex) {
for (i = 0;i < nlen[0];++i)
bufp += OUTPUT(bufp, bufe - bufp,
"%.02x", (0xff & ((char)*(row[0]+i))));
} else{
"%.02x", (0xff & ((char)*(row[0]+i))));
} else {
for (i = 0;i < nlen[0];++i)
bufp += OUTPUT(bufp, bufe - bufp,
"%c", (char)*(row[0]+i));
"%c", (char)*(row[0]+i));
}
bufp += OUTPUT(bufp, bufe - bufp, "\n");
......@@ -8253,13 +8272,22 @@ COMMAND_PROTOTYPE(dotpmpubkey)
}
nrows = mysql_num_rows(res);
if (!nrows) {
error("%s: no tpmx509 in database for this node.\n",
error("%s: no node_hostkeys info in the database!\n",
reqp->nodeid);
mysql_free_result(res);
return 1;
}
row = mysql_fetch_row(res);
if (!row || !row[0]) {
mysql_free_result(res);
#if 0 /* not an error yet */
error("%s: no x509 cert.\n", reqp->nodeid);
return 1;
#endif
return 0;
}
OUTPUT(buf, sizeof(buf), "TPMPUB=%s\n", row[0]);
client_writeback(sock, buf, strlen(buf), tcp);
......
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