Beispiel #1
0
/* copy acl list at end of parser start, update current */
static
void append_acl(acl_options_t** start, acl_options_t** cur,
	acl_options_t* list)
{
	while(list) {
		acl_options_t* acl = copy_acl(cfg_parser->opt->region, list);
		acl->next = NULL;
		if(*cur)
			(*cur)->next = acl;
		else	*start = acl;
		*cur = acl;
		list = list->next;
	}
}
Beispiel #2
0
int
main (int argc, char *argv[])
{
  const char *file1;
  const char *file2;
  int fd1;
  struct stat statbuf;
  int mode;
  int fd2;

  set_program_name (argv[0]);

  ASSERT (argc == 3);

  file1 = argv[1];
  file2 = argv[2];

  fd1 = open (file1, O_RDONLY);
  if (fd1 < 0 || fstat (fd1, &statbuf) < 0)
    {
      fprintf (stderr, "could not open file \"%s\"\n", file1);
      exit (EXIT_FAILURE);
    }
  mode = statbuf.st_mode & 07777;

  fd2 = open (file2, O_WRONLY, 0600);
  if (fd2 < 0)
    {
      fprintf (stderr, "could not open file \"%s\"\n", file2);
      exit (EXIT_FAILURE);
    }

#if USE_ACL
  if (copy_acl (file1, fd1, file2, fd2, mode))
    exit (EXIT_FAILURE);
#else
  chmod (file2, mode);
#endif

  close (fd2);
  close (fd1);

  return 0;
}
Beispiel #3
0
static acl_options_t*
copy_acl_list(nsd_options_t* opt, acl_options_t* a)
{
	acl_options_t* b, *blast = NULL, *blist = NULL;
	while(a) {
		b = copy_acl(opt->region, a);
		/* fixup key_options */
		if(b->key_name)
			b->key_options = key_options_find(opt, b->key_name);
		else	b->key_options = NULL;

		/* link as last into list */
		b->next = NULL;
		if(!blist) blist = b;
		else blast->next = b;
		blast = b;
		
		a = a->next;
	}
	return blist;
}