]> git.sur5r.net Git - bacula/bacula/commitdiff
- Add Enabled column to Location, correct some typos in DB schemas.
authorKern Sibbald <kern@sibbald.com>
Mon, 10 Jul 2006 20:09:17 +0000 (20:09 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 10 Jul 2006 20:09:17 +0000 (20:09 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3136 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kes-1.39
bacula/src/cats/make_mysql_tables.in
bacula/src/cats/make_postgresql_tables.in
bacula/src/cats/make_sqlite3_tables.in
bacula/src/cats/make_sqlite_tables.in
bacula/src/cats/update_mysql_tables.in
bacula/src/cats/update_postgresql_tables.in
bacula/src/cats/update_sqlite3_tables.in
bacula/src/cats/update_sqlite_tables.in
bacula/src/lib/bsys.c

index 14576d006b9a3d3e0053fd79eac804e4b65fb083..06aa058c641a6836419937e6132f2fa5177193ca 100644 (file)
@@ -3,6 +3,7 @@
 
 General:
 10Jul06
+- Add Enabled column to Location, correct some typos in DB schemas.
 - Correct bug I introduced into RunScripts enum.
 - Add log table to Catalog
 - Purge original job migrated if the migration terminates normally.
index d2319f49c4924795ac6aa342ee6c674073995a8d..8ce92132c07862e0716d5e6ca2b5abccff1f9a50 100644 (file)
@@ -119,6 +119,7 @@ CREATE TABLE Location (
    LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    Location TINYBLOB NOT NULL,
    Cost INTEGER DEFAULT 0,
+   Enabled TINYINT,
    PRIMARY KEY(LocationId)
    );
 
index 9641cd3da59e8ed081188640337e58f209969764..261227bd26fe344e2efaee33ae403946f83261ae 100644 (file)
@@ -82,6 +82,7 @@ CREATE TABLE Location (
    LocationId        serial      not null,
    Location          text        not null,
    Cost              integer     default 0,
+   Enabled           smallint,
    primary key (LocationId)
 );
 
index 3838ec31088735b579835cb64415a2e88ba406d6..7e49d713a2054f8ac0a54f38c7054359f4de07ce 100644 (file)
@@ -78,7 +78,8 @@ CREATE INDEX inx6 ON Job (Name);
 CREATE TABLE Location (
    LocationId INTEGER,
    Location TINYBLOB NOT NULL,
-   Cost INTEGER,
+   Cost INTEGER DEFAULT 0,
+   Enabled TINYINT,
    PRIMARY KEY(LocationId)
    );
 
index 3838ec31088735b579835cb64415a2e88ba406d6..7e49d713a2054f8ac0a54f38c7054359f4de07ce 100644 (file)
@@ -78,7 +78,8 @@ CREATE INDEX inx6 ON Job (Name);
 CREATE TABLE Location (
    LocationId INTEGER,
    Location TINYBLOB NOT NULL,
-   Cost INTEGER,
+   Cost INTEGER DEFAULT 0,
+   Enabled TINYINT,
    PRIMARY KEY(LocationId)
    );
 
index 7008e38cc1dcd5d32e0085f17f1b4105726cb794..c59e46f86edcecf8a8ee81127b10f16cf3f35f06 100755 (executable)
@@ -36,6 +36,7 @@ CREATE TABLE Location (
    LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    Location TINYBLOB NOT NULL,
    Cost INTEGER DEFAULT 0,
+   Enabled TINYINT,
    PRIMARY KEY(LocationId)
    );
 
index 03b8ee8ca0c512eb9bd32dfdbfafdc531396a3cc..afb05793e61a04218281efe733e268b5f709c604 100755 (executable)
@@ -38,7 +38,8 @@ ALTER TABLE jobmedia DROP COLUMN Stripe;
 CREATE TABLE Location (
    LocationId SERIAL NOT NULL,
    Location TEXT NOT NULL,
-   Cost integer not null default 0,
+   Cost integer default 0,
+   Enabled integer,
    PRIMARY KEY (LocationId)
 );
 
index b40c9a8bccecc03293ab31d8307f0fe978588a5a..399497bae06918a4c90824bfa251f5815c5119b0 100755 (executable)
@@ -222,7 +222,8 @@ CREATE TABLE Log
 CREATE TABLE Location (
    LocationId INTEGER,
    Location VARCHAR(128) NOT NULL,
-   Counter INTEGER DEFAULT 0,
+   Cost INTEGER DEFAULT 0,
+   Enabled TINYINT,
    PRIMARY KEY(LocationId)
    );
  
index b40c9a8bccecc03293ab31d8307f0fe978588a5a..399497bae06918a4c90824bfa251f5815c5119b0 100755 (executable)
@@ -222,7 +222,8 @@ CREATE TABLE Log
 CREATE TABLE Location (
    LocationId INTEGER,
    Location VARCHAR(128) NOT NULL,
-   Counter INTEGER DEFAULT 0,
+   Cost INTEGER DEFAULT 0,
+   Enabled TINYINT,
    PRIMARY KEY(LocationId)
    );
  
index 86b437f07355eadad77e0344faadd6af83019de4..9b0dd5f6245de8b15abea274a1793cf0f46879b0 100644 (file)
@@ -621,6 +621,8 @@ void drop(char *uname, char *gname)
    struct passwd *passw = NULL;
    struct group *group = NULL;
    gid_t gid;
+   uid_t uid;
+   char username[1000];         
 
    Dmsg2(900, "uname=%s gname=%s\n", uname?uname:"NONE", gname?gname:"NONE");
    if (!uname && !gname) {
@@ -642,6 +644,10 @@ void drop(char *uname, char *gname)
          uname = passw->pw_name;
       }
    }
+   /* Any OS uname pointer may get overwritten, so save name, uid, and gid */
+   bstrncpy(username, uname, sizeof(username));
+   uid = passw->pw_uid;
+   gid = passw->pw_gid;
    if (gname) {
       if ((group = getgrnam(gname)) == NULL) {
          berrno be;
@@ -649,29 +655,27 @@ void drop(char *uname, char *gname)
             be.strerror());
       }
       gid = group->gr_gid;
-   } else {
-      gid = passw->pw_gid;
    }
-   if (initgroups(passw->pw_name, passw->pw_gid)) {
+   if (initgroups(username, gid)) {
       berrno be;
       if (gname) {
          Emsg3(M_ERROR_TERM, 0, _("Could not initgroups for group=%s, userid=%s: ERR=%s\n"),         
-            gname, uname, be.strerror());
+            gname, username, be.strerror());
       } else {
          Emsg2(M_ERROR_TERM, 0, _("Could not initgroups for userid=%s: ERR=%s\n"),         
-            uname, be.strerror());
+            username, be.strerror());
       }
    }
    if (gname) {
-      if (setgid(group->gr_gid)) {
+      if (setgid(gid)) {
          berrno be;
          Emsg2(M_ERROR_TERM, 0, _("Could not set group=%s: ERR=%s\n"), gname,
             be.strerror());
       }
    }
-   if (setuid(passw->pw_uid)) {
+   if (setuid(uid)) {
       berrno be;
-      Emsg1(M_ERROR_TERM, 0, _("Could not set specified userid: %s\n"), uname);
+      Emsg1(M_ERROR_TERM, 0, _("Could not set specified userid: %s\n"), username);
    }
 #endif
 }