ソースを参照

Merge pull request #11085 from mayx/HPCC-18370-daliadmin

HPCC-18370 Daliadmin silently quits when xpath ends with /

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 7 年 前
コミット
e4c6cc9b0f
1 ファイル変更4 行追加15 行削除
  1. 4 15
      dali/daliadmin/daliadmin.cpp

+ 4 - 15
dali/daliadmin/daliadmin.cpp

@@ -171,7 +171,10 @@ static const char *splitpath(const char *path,StringBuffer &head,StringBuffer &t
 {
     if (path[0]!='/')
         path = tmp.append('/').append(path).str();
-    return splitXPath(path, head);
+    const char *tail = splitXPath(path, head);
+    if (!tail)
+        throw MakeStringException(0, "Expecting xpath tail node in: %s", path);
+    return tail;
 }
 
 // NB: there's strtoll under Linux
@@ -271,8 +274,6 @@ static void import(const char *path,const char *src,bool add)
     StringBuffer head;
     StringBuffer tmp;
     const char *tail=splitpath(path,head,tmp);
-    if (!tail)
-        return;
     if (!add) {
         Owned<IRemoteConnection> bconn = querySDS().connect(remLeading(path),myProcessSession(),RTM_LOCK_READ|RTM_SUB, daliConnectTimeoutMs);
         if (bconn) {
@@ -330,8 +331,6 @@ static void _delete_(const char *path,bool backup)
     StringBuffer head;
     StringBuffer tmp;
     const char *tail=splitpath(path,head,tmp);
-    if (!tail)
-        return;
     Owned<IRemoteConnection> conn = querySDS().connect(head.str(),myProcessSession(),RTM_LOCK_WRITE, daliConnectTimeoutMs);
     if (!conn) {
         ERRLOG("Could not connect to %s",path);
@@ -364,8 +363,6 @@ static void set(const char *path,const char *val)
     StringBuffer head;
     StringBuffer tmp;
     const char *tail=splitpath(path,head,tmp);
-    if (!tail)
-        return;
     Owned<IRemoteConnection> conn = querySDS().connect(head.str(),myProcessSession(),RTM_LOCK_WRITE, daliConnectTimeoutMs);
     if (!conn) {
         ERRLOG("Could not connect to %s",path);
@@ -389,8 +386,6 @@ static void get(const char *path)
     StringBuffer head;
     StringBuffer tmp;
     const char *tail=splitpath(path,head,tmp);
-    if (!tail)
-        return;
     Owned<IRemoteConnection> conn = querySDS().connect(head.str(),myProcessSession(),RTM_LOCK_READ, daliConnectTimeoutMs);
     if (!conn) {
         ERRLOG("Could not connect to %s",path);
@@ -411,8 +406,6 @@ static void bget(const char *path,const char *outfn)
     StringBuffer head;
     StringBuffer tmp;
     const char *tail=splitpath(path,head,tmp);
-    if (!tail)
-        return;
     Owned<IRemoteConnection> conn = querySDS().connect(head.str(),myProcessSession(),RTM_LOCK_READ, daliConnectTimeoutMs);
     if (!conn) {
         ERRLOG("Could not connect to %s",path);
@@ -480,8 +473,6 @@ static void wget(const char *path)
     StringBuffer head;
     StringBuffer tmp;
     const char *tail=splitpath(path,head,tmp);
-    if (!tail)
-        return;
     Owned<IRemoteConnection> conn = querySDS().connect(head.str(),myProcessSession(),RTM_LOCK_READ, daliConnectTimeoutMs);
     if (!conn) {
         ERRLOG("Could not connect to %s",path);
@@ -527,8 +518,6 @@ static void delv(const char *path)
     StringBuffer head;
     StringBuffer tmp;
     const char *tail=splitpath(path,head,tmp);
-    if (!tail)
-        return;
     Owned<IRemoteConnection> conn = querySDS().connect(head.str(),myProcessSession(),RTM_LOCK_WRITE, daliConnectTimeoutMs);
     if (!conn) {
         ERRLOG("Could not connect to %s",path);