char *file;
char *tdbname;
- path = talloc_strdup(ctx, state_path("eventlog"));
+ path = state_path("eventlog");
if (!path) {
return NULL;
}
return NULL;
}
- tdbname = talloc_asprintf(path, "%s/%s", state_path("eventlog"), file);
+ tdbname = talloc_asprintf(ctx, "%s/%s", path, file);
if (!tdbname) {
talloc_free(path);
return NULL;
}
+ talloc_free(path);
return tdbname;
}
/* read a record, add the amt to nbytes */
key.dsize = sizeof(int32_t);
key.dptr = (unsigned char *)&i;
- ret = tdb_fetch_compat( the_tdb, key );
+ ret = tdb_fetch( the_tdb, key );
if ( ret.dsize == 0 ) {
DEBUG( 8,
( "Can't find a record for the key, record [%d]\n",
ELOG_TDB *tdb_node = NULL;
char *eventlogdir;
TALLOC_CTX *ctx = talloc_tos();
+ bool ok;
/* check for invalid options */
/* make sure that the eventlog dir exists */
- eventlogdir = state_path( "eventlog" );
- if ( !directory_exist( eventlogdir ) )
- mkdir( eventlogdir, 0755 );
+ eventlogdir = state_path("eventlog");
+ if (eventlogdir == NULL) {
+ return NULL;
+ }
+ ok = directory_create_or_exist(eventlogdir, 0755);
+ TALLOC_FREE(eventlogdir);
+ if (!ok) {
+ return NULL;
+ }
/* get the path on disk */
}
} else if ( 0 == strncmp( start, "STR", stop - start ) ) {
size_t tmp_len;
- int num_of_strings;
+ size_t num_of_strings;
/* skip past initial ":" */
stop++;
/* now skip any other leading whitespace */
key.dptr = (unsigned char *)&srecno;
key.dsize = sizeof(int32_t);
- data = tdb_fetch_compat(tdb, key);
+ data = tdb_fetch(tdb, key);
if (data.dsize == 0) {
DEBUG(8,("evlog_pull_record_tdb: "
"Can't find a record for the key, record %d\n",
return NT_STATUS_INVALID_SID;
}
if (len > 0) {
- string_to_sid(&e->UserSid, sid_str);
+ bool ok = string_to_sid(&e->UserSid, sid_str);
+ if (!ok) {
+ return NT_STATUS_INVALID_SID;
+ }
}
}