Text   |  XML   |  ReML   |   Visible Warnings:

Uninitialized Variable  at mail-storage.c:225

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

mail_namespaces_init

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/mail-namespace.c)expand/collapse
Show more  
 190  int mail_namespaces_init(struct mail_user *user)
 191  {
 192          struct mail_namespace *namespaces, *ns, **ns_p;
 193          enum mail_storage_flags flags;
 194          enum file_lock_method lock_method;
 195          const char *mail, *data, *error;
 196          unsigned int i;
 197   
 198          mail_storage_parse_env(&flags, &lock_method);
 199          namespaces = NULL; ns_p = &namespaces;
 200   
 201          /* first try NAMESPACE_* environments */
 202          for (i = 1; ; i++) {
 203                  T_BEGIN {
 204                          data = getenv(t_strdup_printf("NAMESPACE_%u", i));
 205                  } T_END;
 206   
 207                  if (data == NULL)
 208                          break;
 209   
 210                  T_BEGIN {
 211                          *ns_p = namespace_add_env(data, i, user, flags,
 212                                                    lock_method, namespaces);
 213                  } T_END;
 214   
 215                  if (*ns_p == NULL)
 216                          return -1;
 217   
 218                  ns_p = &(*ns_p)->next;
 219          }
 220   
 221          if (namespaces != NULL) {
 222                  if (!namespaces_check(namespaces)) {
 223                          while (namespaces != NULL) {
 224                                  ns = namespaces;
 225                                  namespaces = ns->next;
 226                                  mail_namespace_free(ns);
 227                          }
 228                          return -1;
 229                  }
 230                  mail_user_add_namespace(user, &namespaces);
 231   
 232                  if (hook_mail_namespaces_created != NULL) {
 233                          T_BEGIN {
 234                                  hook_mail_namespaces_created(namespaces);
 235                          } T_END;
 236                  }
 237                  return 0;
 238          }
 239   
 240          /* fallback to MAIL */
 241          mail = getenv("MAIL");
 242          if (mail == NULL) {
 243                  /* support also maildir-specific environment */
 244                  mail = getenv("MAILDIR");
 245                  if (mail != NULL)
 246                          mail = t_strconcat("maildir:", mail, NULL);
 247          }
 248   
 249          ns = i_new(struct mail_namespace, 1);
 250          ns->type = NAMESPACE_PRIVATE;
 251          ns->flags = NAMESPACE_FLAG_INBOX | NAMESPACE_FLAG_LIST_PREFIX |
 252                  NAMESPACE_FLAG_SUBSCRIPTIONS;
 253          ns->prefix = i_strdup("");
 254          ns->user = user;
 255          ns->owner = user;
 256   
 257          if (mail_storage_create(ns, NULL, mail, flags, lock_method,
 258[+]                                 &error) < 0) {
expand/collapse

mail_storage_create

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/mail-storage.c)expand/collapse
Show more  
 160  int mail_storage_create(struct mail_namespace *ns, const char *driver,
 161                          const char *data, enum mail_storage_flags flags,
 162                          enum file_lock_method lock_method,
 163                          const char **error_r)
 164  {
 165          struct mail_storage *storage_class, *storage = NULL;
 166          struct mail_storage *const *classes;
 167          const char *home, *value;
 168          unsigned int i, count;
 169   
 170          if (data == NULL)
 171                  data = "";
 172          else if (driver == NULL)
 173                  mail_storage_set_autodetection(&data, &driver, &flags);
 174   
 175          if (*data == '\0' && driver == NULL) {
 176                  /* use the first driver that works */
 177[+]                 classes = array_get(&storages, &count);
 178          } else if (driver == NULL) {
 179                  storage_class = mail_storage_autodetect(data, flags);
 180                  if (storage_class == NULL) {
 181                          *error_r = t_strdup_printf(
 182                                  "Ambiguous mail location setting, "
 183                                  "don't know what to do with it: %s "
 184                                  "(try prefixing it with mbox: or maildir:)",
 185                                  data);
 186                          return -1;
 187                  }
 188                  classes = &storage_class;
 189                  count = 1;
 190          } else {
 191                  storage_class = mail_storage_find_class(driver);
 192                  if (storage_class == NULL) {
 193                          *error_r = t_strdup_printf(
 194                                  "Unknown mail storage driver %s", driver);
 195                          return -1;
 196                  }
 197                  classes = &storage_class;
 198                  count = 1;
 199          }
 200   
 201          for (i = 0; i < count; i++) {
 202                  storage = classes[i]->v.alloc();
 203                  storage->flags = flags;
 204                  storage->lock_method = lock_method;
 205                  storage->ns = ns;
 206   
 207                  storage->callbacks =
 208                          p_new(storage->pool, struct mail_storage_callbacks, 1);
 209                  p_array_init(&storage->module_contexts, storage->pool, 5);
 210   
 211                  if (classes[i]->v.create(storage, data, error_r) == 0)
 212                          break;
 213   
 214                  if ((flags & MAIL_STORAGE_FLAG_DEBUG) != 0 && count > 1) {
 215                          i_info("%s: Couldn't create mail storage %s: %s",
 216                                 classes[i]->name, data, *error_r);
 217                  }
 218   
 219                  /* try the next one */
 220                  pool_unref(&storage->pool);
 221          }
 222          if (i == count) {
 223                  if (count <= 1) {
 224                          *error_r = t_strdup_printf("%s: %s", classes[0]->name,
 225                                                     *error_r);
Show more  
Show more  




Change Warning 7527.25002 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: