Beispiel #1
0
static void gidcache_add(gid_t gid, const char *name) {
  if (!(auth_caching & PR_AUTH_CACHE_FL_GID2NAME)) {
    return;
  }

  gidcache_create();

  if (gid_tab) {
    int count;

    (void) pr_table_rewind(gid_tab);
    count = pr_table_kexists(gid_tab, (const void *) &gid, sizeof(gid_t));
    if (count <= 0) {
      gid_t *cache_gid;

      /* Allocate memory for a GID out of the ID cache pool, so that this
       * GID can be used as a key.
       */
      cache_gid = palloc(auth_pool, sizeof(gid_t));
      *cache_gid = gid;

      if (pr_table_kadd(gid_tab, (const void *) cache_gid, sizeof(gid_t),
          pstrdup(auth_pool, name), strlen(name) + 1) < 0 &&
          errno != EEXIST) {
        pr_trace_msg(trace_channel, 3,
          "error adding name '%s' for GID %lu to the gidcache: %s", name,
          (unsigned long) gid, strerror(errno));

      } else {
        pr_trace_msg(trace_channel, 5,
          "stashed name '%s' for GID %lu in the gidcache", name,
          (unsigned long) gid);
      }
    }
  }
}
Beispiel #2
0
void pr_var_rewind(void) {
  if (var_tab != NULL) {
    pr_table_rewind(var_tab);
  }
}
Beispiel #3
0
void pr_var_rewind(void) {
  if (var_tab)
    pr_table_rewind(var_tab);
}