]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[OpenSM] - Add guid2lid full path name to the error message when there was a problem...
authoreitan <eitan@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 8 Mar 2006 09:36:49 +0000 (09:36 +0000)
committereitan <eitan@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 8 Mar 2006 09:36:49 +0000 (09:36 +0000)
Also, make sure the size of the words in guid2lid file is legal.

git-svn-id: svn://openib.tc.cornell.edu/gen1@233 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/ulp/opensm/user/opensm/osm_db_files.c

index 9d53f4b9bbf14edda31d878786b25e90cd0ea808..917c3451af909e7d61ea0e4f429a9493fd3e01dc 100644 (file)
 #define OSM_DB_MAX_LINE_LEN 1024
 /**********/
 
+/****d* Database/OSM_DB_MAX_WORD_LEN
+ * NAME
+ * OSM_DB_MAX_WORD_LEN
+ *
+ * DESCRIPTION
+ * The Maximal word length allowed for the file (guid or lid)
+ *
+ * SYNOPSIS
+ */
+#define OSM_DB_MAX_WORD_LEN 32
+/**********/
+
 /****s* OpenSM: Database/osm_db_domain_imp
  * NAME
  * osm_db_domain_imp
@@ -332,8 +344,17 @@ osm_db_restore(
         {
           osm_log( p_log, OSM_LOG_ERROR,
                    "osm_db_restore: ERR 6104: "
-                   " Fail to get key from line:%u : %s\n",
-                   line_num, sLine);
+                   " Fail to get key from line:%u : %s (file:%s)\n",
+                   line_num, sLine, p_domain_imp->file_name);
+          status = 1;
+          goto EndParsing;
+        }
+        if (strlen(p_first_word) > OSM_DB_MAX_WORD_LEN)
+        {
+          osm_log( p_log, OSM_LOG_ERROR,
+                   "osm_db_restore: ERR 610A: "
+                   " Illegal key from line:%u : %s (file:%s)\n",
+                   line_num, sLine, p_domain_imp->file_name);
           status = 1;
           goto EndParsing;
         }
@@ -344,6 +365,15 @@ osm_db_restore(
         p_rest_of_line = strtok_r(NULL, "\n", &p_last);
         if (p_rest_of_line != NULL)
         {
+          if (strlen(p_rest_of_line) > OSM_DB_MAX_WORD_LEN)
+          {
+            osm_log( p_log, OSM_LOG_ERROR,
+                     "osm_db_restore: ERR 610B: "
+                     " Illegal lids from line:%u : %s (file:%s)\n",
+                     line_num, sLine, p_domain_imp->file_name);
+            status = 1;
+            goto EndParsing;
+          }
           p_accum_val =
             (char*)cl_malloc(sizeof(char)*(strlen(p_rest_of_line) + 1));
           strcpy(p_accum_val, p_rest_of_line);
@@ -358,8 +388,8 @@ osm_db_restore(
       {
         osm_log( p_log, OSM_LOG_ERROR,
                  "osm_db_restore: ERR 6105: "
-                 " How did we get here? line:%u : %s\n",
-                 line_num, sLine);
+                 " How did we get here? line:%u : %s (file:%s)\n",
+                 line_num, sLine, p_domain_imp->file_name);
         status = 1;
         goto EndParsing;
       }