]> git.sur5r.net Git - bacula/bacula/commitdiff
Add uname to client, various fixes
authorKern Sibbald <kern@sibbald.com>
Wed, 2 Apr 2003 15:45:28 +0000 (15:45 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 2 Apr 2003 15:45:28 +0000 (15:45 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@411 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/cats/sql_create.c
bacula/src/cats/sql_update.c
bacula/src/dird/newvol.c
bacula/src/dird/verify.c
bacula/src/lib/sha1.h
bacula/src/stored/dircmd.c

index 50becdf9b6b8394a462df03c75be77c42555c60f..9c693e1c01ba2c5698b98f07eae35fe8c0706364 100644 (file)
@@ -234,7 +234,7 @@ db_create_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr)
    if (QUERY_DB(jcr, mdb, mdb->cmd)) {
       mdb->num_rows = sql_num_rows(mdb);
       if (mdb->num_rows > 0) {
-         Mmsg1(&mdb->errmsg, _("Media record %s already exists\n"), mr->VolumeName);
+         Mmsg1(&mdb->errmsg, _("Volume \"%s\" already exists\n."), mr->VolumeName);
         sql_free_result(mdb);
         db_unlock(mdb);
         return 0;
index eea89901ccc18608c5d7e819e6e00f4af148a90b..4bda78419de275623dca7b9c0c29aa2e6dbb39f9 100644 (file)
@@ -155,9 +155,11 @@ db_update_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cr)
 {
    int stat;
    char ed1[50], ed2[50];
+   CLIENT_DBR tcr;
 
    db_lock(mdb);
-   if (!db_create_client_record(jcr, mdb, cr)) {
+   memcpy(&tcr, cr, sizeof(tcr));
+   if (!db_create_client_record(jcr, mdb, &tcr)) {
       db_unlock(mdb);
       return 0;
    }
index 0b66a86a2bd2a1acd7efb162c23b769b71a5070f..1b1f277d615d0eba7188c2efd94c13487a4d7a29 100644 (file)
@@ -59,13 +59,30 @@ int newVolume(JCR *jcr, MEDIA_DBR *mr)
         bstrncpy(mr->MediaType, jcr->store->media_type, sizeof(mr->MediaType));
         bstrncpy(name, pr.LabelFormat, sizeof(name));
          if (strchr(name, (int)'%') != NULL) {
-           db_unlock(jcr->db);
             Jmsg(jcr, M_ERROR, 0, _("Illegal character in Label Format\n"));
-           return 0;
+           goto bail_out;
+        }
+        /* See if volume already exists */
+        mr->VolumeName[0] = 0;
+        for (int i=pr.NumVols+1; i<(int)pr.NumVols+11; i++) {
+           MEDIA_DBR tmr;
+           memset(&tmr, 0, sizeof(tmr));
+            sprintf(num, "%04d", i);
+           bstrncpy(tmr.VolumeName, name, sizeof(tmr.VolumeName));
+           bstrncat(tmr.VolumeName, num, sizeof(tmr.VolumeName));
+           if (db_get_media_record(jcr, jcr->db, &tmr)) {
+              Jmsg(jcr, M_WARNING, 0, 
+_("Wanted to create Volume \"%s\", but it already exists. Trying again.\n"), 
+                   tmr.VolumeName);
+              continue;
+           }
+           bstrncpy(mr->VolumeName, tmr.VolumeName, sizeof(mr->VolumeName));
+        }
+        if (mr->VolumeName[0] == 0) {
+            Jmsg(jcr, M_ERROR, 0, _("Too many failures. Giving up creating Volume.\n"));
+           goto bail_out;
         }
-         sprintf(num, "%04d", ++pr.NumVols);
-        bstrncpy(mr->VolumeName, name, sizeof(mr->VolumeName));
-        bstrncat(mr->VolumeName, num, sizeof(mr->VolumeName));
+        pr.NumVols++;
         if (db_create_media_record(jcr, jcr->db, mr) &&
            db_update_pool_record(jcr, jcr->db, &pr)) {
            db_unlock(jcr->db);
@@ -76,6 +93,7 @@ int newVolume(JCR *jcr, MEDIA_DBR *mr)
         }
       }
    }
+bail_out:
    db_unlock(jcr->db);
    return 0;   
 }
index d42d91bfc9770ceefc94436071251b3646bbdf15..0fc3ddbf6dccec3378cb8bb21eda580caaff69fd 100644 (file)
@@ -323,7 +323,7 @@ static void verify_cleanup(JCR *jcr, int TermCode)
         msg_type = M_ERROR;          /* Generate error message */
         break;
       case JS_Cancelled:
-         term_msg = _("Verify Cancelled");
+         term_msg = _("Verify Canceled");
         break;
       case JS_Differences:
          term_msg = _("Verify Differences");
index dc10392e22d813d415d5f70e2d8bd7dac55f561f..4bcf470d286c8d40afd8b6c1a48e693da92ba2e2 100644 (file)
@@ -2,15 +2,15 @@
  *  sha1.h
  *
  *  Description:
- *     This is the header file for code which implements the Secure
- *     Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
- *     April 17, 1995.
+ *      This is the header file for code which implements the Secure
+ *      Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
+ *      April 17, 1995.
  *
- *     Many of the variable names in this code, especially the
- *     single character names, were used because those were the names
- *     used in the publication.
+ *      Many of the variable names in this code, especially the
+ *      single character names, were used because those were the names
+ *      used in the publication.
  *
- *     Please read the file sha1.c for more information.
+ *      Please read the file sha1.c for more information.
  *
  * Full Copyright Statement
  *
 /*
  * If you do not have the ISO standard stdint.h header file, then you
  * must typdef the following:
- *    name             meaning
- *  uint32_t        unsigned 32 bit integer
- *  uint8_t         unsigned 8 bit integer (i.e., unsigned char)
- *  int_least16_t    integer of >= 16 bits
+ *    name              meaning
+ *  uint32_t         unsigned 32 bit integer
+ *  uint8_t          unsigned 8 bit integer (i.e., unsigned char)
+ *  int32_t          integer of 32 bits
  *
  */
 
@@ -67,9 +67,9 @@
 enum
 {
     shaSuccess = 0,
-    shaNull,           /* Null pointer parameter */
-    shaInputTooLong,   /* input data too long */
-    shaStateError      /* called Input after Result */
+    shaNull,            /* Null pointer parameter */
+    shaInputTooLong,    /* input data too long */
+    shaStateError       /* called Input after Result */
 };
 #endif
 #define SHA1HashSize 20
@@ -82,15 +82,15 @@ typedef struct SHA1Context
 {
     uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest  */
 
-    uint32_t Length_Low;           /* Message length in bits      */
-    uint32_t Length_High;          /* Message length in bits      */
+    uint32_t Length_Low;            /* Message length in bits      */
+    uint32_t Length_High;           /* Message length in bits      */
 
-                              /* Index into message block array   */
-    int_least16_t Message_Block_Index;
-    uint8_t Message_Block[64];     /* 512-bit message blocks      */
+                               /* Index into message block array   */
+    int32_t Message_Block_Index;
+    uint8_t Message_Block[64];      /* 512-bit message blocks      */
 
-    int Computed;              /* Is the digest computed?         */
-    int Corrupted;            /* Is the message digest corrupted? */
+    int Computed;               /* Is the digest computed?         */
+    int Corrupted;             /* Is the message digest corrupted? */
 } SHA1Context;
 
 /*
@@ -99,9 +99,9 @@ typedef struct SHA1Context
 
 int SHA1Init(SHA1Context *);
 int SHA1Update(SHA1Context *,
-              const uint8_t *,
-              unsigned int);
+               const uint8_t *,
+               unsigned int);
 int SHA1Final(SHA1Context *,
-              uint8_t Message_Digest[SHA1HashSize]);
+               uint8_t Message_Digest[SHA1HashSize]);
 
 #endif
index b8327afc5d0463c172116c483fee29adb98fe4a7..de421646e7ab89946644eb7f8b08e55cb01cca11 100644 (file)
@@ -216,6 +216,13 @@ static int cancel_cmd(JCR *cjcr)
         if (jcr->file_bsock) {
            bnet_sig(jcr->file_bsock, BNET_TERMINATE);
         }
+        /* If thread waiting on mount, wake him */
+        if (jcr->device && jcr->device->dev &&      
+             (jcr->device->dev->dev_blocked == BST_WAITING_FOR_SYSOP ||
+              jcr->device->dev->dev_blocked == BST_UNMOUNTED ||
+              jcr->device->dev->dev_blocked == BST_UNMOUNTED_WAITING_FOR_SYSOP)) {
+            pthread_cond_signal(&jcr->device->dev->wait_next_vol);
+        }
          bnet_fsend(dir, _("3000 Job %s marked to be cancelled.\n"), jcr->Job);
         free_jcr(jcr);
       }