]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/idcache.c
Fix reporting jobs from state file + misc
[bacula/bacula] / bacula / src / lib / idcache.c
index 96f253bd106d4e2cab0d2a300b8e798ac3461b6c..1c16780afc8ce977b92a32b4af52a77c135e63eb 100644 (file)
@@ -52,12 +52,17 @@ char *getuser(uid_t uid)
   pwent = getpwuid(uid);
   tail = (struct userid *)malloc(sizeof (struct userid));
   tail->id.u = uid;
+#ifndef HAVE_WIN32
   if (pwent == 0 || strcmp(pwent->pw_name, "????????") == 0) {
       sprintf(usernum_string, "%u", (uint32_t)uid);
       tail->name = bstrdup(usernum_string);
   } else {
       tail->name = bstrdup(pwent->pw_name);
   }
+#else
+      sprintf(usernum_string, "%u", (uint32_t)uid);
+      tail->name = bstrdup(usernum_string);
+#endif
 
   /* Add to the head of the list, so most recently used is first.  */
   tail->next = user_alist;
@@ -77,6 +82,7 @@ void free_getuser_cache()
      tail = tail->next;
      free(otail);
   }
+  user_alist = NULL;
   V(mutex);
 }
 
@@ -101,13 +107,17 @@ char *getgroup(gid_t gid)
   grent = getgrgid(gid);
   tail = (struct userid *)malloc(sizeof (struct userid));
   tail->id.g = gid;
+#ifndef HAVE_WIN32
   if (grent == 0 || strcmp(grent->gr_name, "????????") == 0) {
       sprintf (groupnum_string, "%u", (uint32_t)gid);
       tail->name = bstrdup(groupnum_string);
   } else {
       tail->name = bstrdup(grent->gr_name);
   }
-
+#else
+      sprintf (groupnum_string, "%u", (uint32_t)gid);
+      tail->name = bstrdup(groupnum_string);
+#endif
   /* Add to the head of the list, so most recently used is first.  */
   tail->next = group_alist;
   group_alist = tail;
@@ -126,5 +136,6 @@ void free_getgroup_cache()
      tail = tail->next;
      free(otail);
   }
+  group_alist = NULL;
   V(mutex);
 }