From 6ae8e298d45a683a5da1771acb6ce237cd37b1ce Mon Sep 17 00:00:00 2001 From: Leigh B Stoller Date: Tue, 7 Dec 2010 11:25:32 -0700 Subject: [PATCH] Changes for protogeni cooked mode. --- tmcd/tmcd.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tmcd/tmcd.c b/tmcd/tmcd.c index 3f13a83f1..8fc0dcd33 100644 --- a/tmcd/tmcd.c +++ b/tmcd/tmcd.c @@ -209,7 +209,8 @@ typedef struct { char testdb[TBDB_FLEN_TINYTEXT]; char sharing_mode[TBDB_FLEN_TINYTEXT]; char privkey[PRIVKEY_LEN+1]; - char urn[URN_LEN+1]; + /* This key is a replacement for privkey, on protogeni resources */ + char external_key[PRIVKEY_LEN+1]; } tmcdreq_t; static int iptonodeid(struct in_addr, tmcdreq_t *, char*); static int checkdbredirect(tmcdreq_t *); @@ -1075,23 +1076,21 @@ handle_request(int sock, struct sockaddr_in *client, char *rdata, int istcp) } /* - * Look for URN. + * Look for external key */ - if (sscanf(bp, "URN=%" XSTRINGIFY(URN_LEN) "s", buf)) { + if (sscanf(bp, "KEY=%" XSTRINGIFY(PRIV_LEN) "s", buf)) { for (i = 0; i < strlen(buf); i++){ - if (! (isalnum(buf[i]) || - buf[i] == '_' || buf[i] == '-' || - buf[i] == '.' || buf[i] == '/' || - buf[i] == ':' || buf[i] == '+')) { + if (! isalnum(buf[i])) { info("tmcd client provided invalid " - "characters in URN"); + "characters in KEY"); goto skipit; } } - strncpy(reqp->urn, buf, sizeof(reqp->urn)); + strncpy(reqp->external_key, + buf, sizeof(reqp->external_key)); if (debug) { - info("URN %s\n", buf); + info("KEY %s\n", buf); } continue; } @@ -1120,12 +1119,13 @@ handle_request(int sock, struct sockaddr_in *client, char *rdata, int istcp) if (privkey) { error("No such node with wanode_key [%s]\n", privkey); } - else if (reqp->urn[0]) { + else if (reqp->external_key[0]) { if (reqp->isvnode) - error("No such vnode %s with urn %s\n", - reqp->vnodeid, reqp->urn); + error("No such vnode %s with key %s\n", + reqp->vnodeid, reqp->external_key); else - error("No such node with urn %s\n", reqp->urn); + error("No such node with key %s\n", + reqp->external_key); } else if (reqp->isvnode) { error("No such vnode %s associated with %s\n", @@ -5546,11 +5546,11 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) else if (reqp->isvnode) { char clause[BUFSIZ]; - if (reqp->urn[0]) { + if (reqp->external_key[0]) { sprintf(clause, - "r.external_resource_id is not null and " - "r.external_resource_id='%s'", - reqp->urn); + "r.external_resource_key is not null and " + "r.external_resource_key='%s'", + reqp->external_key); } else { sprintf(clause, @@ -5596,11 +5596,11 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp, char* nodekey) else { char clause[BUFSIZ]; - if (reqp->urn[0]) { + if (reqp->external_key[0]) { sprintf(clause, - "r.external_resource_id is not null and " - "r.external_resource_id='%s'", - reqp->urn); + "r.external_resource_key is not null and " + "r.external_resource_key='%s'", + reqp->external_key); } else { sprintf(clause, -- GitLab