*/
#include "includes.h"
+#include "system/filesys.h"
#include "popt_common.h"
#include "registry/reg_objects.h"
-#include "regfio.h"
-#include "../libcli/security/dom_sid.h"
+#include "registry/regfio.h"
+#include "../libcli/security/security.h"
/* GLOBAL VARIABLES */
/* swap out the SIDs in the security descriptor */
- if ( !(new_sd = dup_sec_desc( outfile->mem_ctx, nk->sec_desc->sec_desc )) ) {
- fprintf( stderr, "Failed to copy security descriptor!\n" );
+ if (nk->sec_desc->sec_desc == NULL) {
+ fprintf(stderr, "Invalid (NULL) security descriptor!\n");
+ return false;
+ }
+
+ new_sd = security_descriptor_copy(outfile->mem_ctx,
+ nk->sec_desc->sec_desc);
+ if (new_sd == NULL) {
+ fprintf(stderr, "Failed to copy security descriptor!\n");
return False;
}
/*********************************************************************
*********************************************************************/
-int main( int argc, char *argv[] )
+int main( int argc, const char *argv[] )
{
TALLOC_CTX *frame = talloc_stackframe();
int opt;
/* setup logging options */
- setup_logging( "profiles", True );
- dbf = x_stderr;
- x_setbuf( x_stderr, NULL );
+ setup_logging( "profiles", DEBUG_STDERR);
- pc = poptGetContext("profiles", argc, (const char **)argv, long_options,
+ pc = poptGetContext("profiles", argc, argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
poptSetOtherOptionHelp(pc, "<profilefile>");
exit (1);
}
- if ( !(outfile = regfio_open( new_filename, (O_RDWR|O_CREAT|O_TRUNC), (S_IREAD|S_IWRITE) )) ) {
+ if ( !(outfile = regfio_open( new_filename, (O_RDWR|O_CREAT|O_TRUNC),
+ (S_IRUSR|S_IWUSR) )) ) {
fprintf( stderr, "Failed to open new file %s!\n", new_filename );
fprintf( stderr, "Error was (%s)\n", strerror(errno) );
exit (1);