summaryrefslogtreecommitdiffstats
path: root/source4/scripting/python
Commit message (Expand)AuthorAgeFilesLines
...
* samba-tool: gpo: Use utility function dc_url() to set the connection urlAmitay Isaacs2012-07-031-9/+18
* samba-tool: gpo: Refactor code using utility functionsAmitay Isaacs2012-07-031-40/+8
* samba-tool: gpo: Add utility functions get_gpo_containers and del_gpo_linkAmitay Isaacs2012-07-031-0/+50
* samba-tool: Fix indentationAmitay Isaacs2012-07-032-4/+4
* samba-tool: gpo: Use gpo (id) instead of gpo_dn (DN)Amitay Isaacs2012-07-031-3/+3
* samba-tool: gpo: Correct the attribute name from gPlink to gPLinkAmitay Isaacs2012-07-031-3/+3
* samba-tool: gpo: Fix policy DNAmitay Isaacs2012-07-031-1/+1
* s4-join: Setup correct DNS configurationAndrew Bartlett2012-06-242-28/+76
* s4-join: Import DNS zones in AD DC joinAndrew Bartlett2012-06-252-20/+57
* s4-classicupgrade: Allow DNS backend to be specifiedAndrew Bartlett2012-06-242-6/+12
* samdb: Accept a list of member variables rather than a comma-separated string.Jelmer Vernooij2012-06-212-6/+8
* s4-provision: Give better clues on what Samba needs for s3fs ACL supportAndrew Bartlett2012-06-211-1/+7
* samba-tool: gpo: Fix creation of filesystem ACL from directory ACLAmitay Isaacs2012-06-211-2/+8
* s4-idmap: Add parameter 'idmap_ldb:use rfc2307' and correct implementation er...Andrew Bartlett2012-06-202-2/+6
* s4-provision: Remove --slapd-path optionAndrew Bartlett2012-06-201-1/+1
* s4-provision: Remove last unused remenants of the 'sid generator' configurationAndrew Bartlett2012-06-201-10/+3
* s4-classicupgrade: Also ask testparm for 'smb passwd file'Andrew Bartlett2012-06-161-0/+2
* s4-classicupgrade: Use "samba classic" description for samba3 NT4-like domain...Andrew Bartlett2012-06-161-8/+9
* s4-lib/param: FLAG DAY for the default FILE SERVERAndrew Bartlett2012-06-161-4/+4
* s4-s3upgrade: Assert that administrator has a SID of -500, and only skip root...Andrew Bartlett2012-06-161-2/+9
* s4-s3upgrade: Add my wins.dat and fix the parsing errorAndrew Bartlett2012-06-161-1/+2
* s4-s3upgrade: improve idmap import to use posixAccount and posixGroup entriesAndrew Bartlett2012-06-161-2/+32
* s4-dbcheck: Always specify the dhcheck controlAndrew Bartlett2012-06-161-0/+1
* lib/param: Use server role = 'standalone server' to be consistant with member...Andrew Bartlett2012-06-152-7/+11
* lib/param: Create a seperate server role for "active directory domain control...Andrew Bartlett2012-06-151-13/+14
* s4:tests: fix use of a non-existent word (existant)Michael Adam2012-06-123-4/+4
* s4:provision: fix use of non-existent word (existant)Michael Adam2012-06-121-1/+1
* s4 dns: Correctly handle A questions for CNAMEsKai Blin2012-06-061-0/+76
* s4 dns: Structure tests a bit betterKai Blin2012-06-061-0/+3
* s4-provision: Test for posix ACLs in the actual sysvol pathAndrew Bartlett2012-06-051-12/+16
* s4-provision: Place xattr.tdb in the actual state directoryAndrew Bartlett2012-06-051-13/+14
* Add '--use-ntvfs' option to 'samba-tool domain join'Andriy Syrovenko2012-06-052-13/+17
* s4-provision: Use the s3fs file server by default in migrationsAndrew Bartlett2012-05-301-1/+1
* s4:dbchecker - handle the "none" case correctlyMatthias Dieter Wallnöfer2012-05-291-1/+1
* Avoid all(), as it's not available in Python 2.4.Jelmer Vernooij2012-05-271-1/+5
* s4: samba-tool is usable without export-keytab command, make sure it does not...Alexander Bokovoy2012-05-231-19/+22
* When listing group members allow fallback to cn attribute when samAccountName...Lukasz Zalewski2012-05-101-2/+5
* s4-provision Ensure we have posix ACLs before we permit a s3fs-based Samba4 t...Andrew Bartlett2012-05-081-0/+14
* s4-s3-upgrade: Max/min password age policy is in seconds, not daysAndrew Bartlett2012-05-061-2/+2
* provision: remove reference to no longer existing template files.Jelmer Vernooij2012-05-031-7/+5
* s4-samba-tool: make new samba-tool group listmembers use samAccountNameAndrew Bartlett2012-05-032-4/+4
* s4-s3upgrade: Force ldapsam:trusted = yesAndrew Bartlett2012-05-031-0/+3
* Extension to the samba-tool group subcommand functionality to allow listing o...Lukasz Zalewski2012-05-032-0/+85
* s4-s3upgrade: Try harder to get group memberships on upgradeAndrew Bartlett2012-05-031-5/+20
* s4-provision: Fix up --use-s3fs to create the directory for xattr.tdbAndrew Bartlett2012-05-021-4/+8
* s4-provision: set 'dcerpc endpoint servers' but not 'vfs objects'Andrew Bartlett2012-05-021-1/+1
* s4-s3upgrade: print the error message from passdb.error exceptionsAndrew Bartlett2012-04-241-6/+6
* s4-python: Ensure we handle the no-eadb case for system xattrs in get/setntaclAndrew Bartlett2012-04-191-0/+1
* Added number of FSMO roles owned by the server we are trying to demote.Daniele Dario2012-04-191-1/+1
* waf: Fix mispellingSimo Sorce2012-04-191-1/+1
="hl opt">); fail_if(ret == -1, "Cannot close file\n"); return ret; } START_TEST(test_remove_tree) { int ret; char origpath[PATH_MAX+1]; errno = 0; fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n"); fail_unless(errno == 0, "Cannot getcwd\n"); DEBUG(SSSDBG_FUNC_DATA, "About to delete %s\n", dir_path); /* create a file */ ret = chdir(dir_path); fail_if(ret == -1, "Cannot chdir1\n"); ret = create_simple_file("bar", "bar"); fail_if(ret == -1, "Cannot create file1\n"); /* create a subdir and file inside it */ ret = mkdir("subdir", 0700); fail_if(ret == -1, "Cannot create subdir\n"); ret = chdir("subdir"); fail_if(ret == -1, "Cannot chdir\n"); ret = create_simple_file("foo", "foo"); fail_if(ret == -1, "Cannot create file\n"); /* create another subdir, empty this time */ ret = mkdir("subdir2", 0700); fail_if(ret == -1, "Cannot create subdir\n"); ret = chdir(origpath); fail_if(ret == -1, "Cannot chdir2\n"); /* go back */ ret = chdir(origpath); fail_if(ret == -1, "Cannot chdir\n"); /* and finally wipe it out.. */ ret = remove_tree(dir_path); fail_unless(ret == EOK, "remove_tree failed\n"); /* check if really gone */ ret = access(dir_path, F_OK); fail_unless(ret == -1, "directory still there after remove_tree\n"); } END_TEST START_TEST(test_simple_copy) { int ret; char origpath[PATH_MAX+1]; char *tmp; int fd = -1; errno = 0; fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n"); fail_unless(errno == 0, "Cannot getcwd\n"); /* create a file */ ret = chdir(dir_path); fail_if(ret == -1, "Cannot chdir1\n"); ret = create_simple_file("bar", "bar"); fail_if(ret == -1, "Cannot create file1\n"); /* create a subdir and file inside it */ ret = mkdir("subdir", 0700); fail_if(ret == -1, "Cannot create subdir\n"); ret = chdir("subdir"); fail_if(ret == -1, "Cannot chdir\n"); ret = create_simple_file("foo", "foo"); fail_if(ret == -1, "Cannot create file\n"); /* go back */ ret = chdir(origpath); fail_if(ret == -1, "Cannot chdir\n"); /* and finally copy.. */ DEBUG(SSSDBG_FUNC_DATA, "Will copy from '%s' to '%s'\n", dir_path, dst_path); ret = copy_tree(dir_path, dst_path, 0700, uid, gid); fail_unless(ret == EOK, "copy_tree failed\n"); /* check if really copied */ ret = access(dst_path, F_OK); fail_unless(ret == 0, "destination directory not there\n"); tmp = talloc_asprintf(test_ctx, "%s/bar", dst_path); ret = check_and_open_readonly(tmp, &fd, uid, gid, S_IFREG|S_IRWXU, 0); fail_unless(ret == EOK, "Cannot open %s\n"); close(fd); talloc_free(tmp); } END_TEST START_TEST(test_copy_symlink) { int ret; char origpath[PATH_MAX+1]; char *tmp; struct stat statbuf; errno = 0; fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n"); fail_unless(errno == 0, "Cannot getcwd\n"); /* create a subdir */ ret = chdir(dir_path); fail_if(ret == -1, "Cannot chdir\n"); ret = create_simple_file("footarget", "foo"); fail_if(ret == -1, "Cannot create file\n"); ret = symlink("footarget", "foolink"); fail_if(ret == -1, "Cannot create symlink\n"); /* go back */ ret = chdir(origpath); fail_if(ret == -1, "Cannot chdir\n"); /* and finally copy.. */ DEBUG(SSSDBG_FUNC_DATA, "Will copy from '%s' to '%s'\n", dir_path, dst_path); ret = copy_tree(dir_path, dst_path, 0700, uid, gid); fail_unless(ret == EOK, "copy_tree failed\n"); /* check if really copied */ ret = access(dst_path, F_OK); fail_unless(ret == 0, "destination directory not there\n"); tmp = talloc_asprintf(test_ctx, "%s/foolink", dst_path); ret = lstat(tmp, &statbuf); fail_unless(ret == 0, "cannot stat the symlink %s\n", tmp); fail_unless(S_ISLNK(statbuf.st_mode), "%s not a symlink?\n", tmp); talloc_free(tmp); } END_TEST START_TEST(test_copy_node) { int ret; char origpath[PATH_MAX+1]; char *tmp; errno = 0; fail_unless(getcwd(origpath, PATH_MAX) == origpath, "Cannot getcwd\n"); fail_unless(errno == 0, "Cannot getcwd\n"); /* create a node */ ret = chdir(dir_path); fail_if(ret == -1, "Cannot chdir\n"); ret = mknod("testnode", S_IFIFO | S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH, 0); fail_unless(ret == 0, "cannot stat /dev/null: %s", strerror(errno)); /* go back */ ret = chdir(origpath); fail_if(ret == -1, "Cannot chdir\n"); /* and finally copy.. */ DEBUG(SSSDBG_FUNC_DATA, "Will copy from '%s' to '%s'\n", dir_path, dst_path); ret = copy_tree(dir_path, dst_path, 0700, uid, gid); fail_unless(ret == EOK, "copy_tree failed\n"); /* check if really copied and without special files */ ret = access(dst_path, F_OK); fail_unless(ret == 0, "destination directory not there\n"); tmp = talloc_asprintf(test_ctx, "%s/testnode", dst_path); ret = access(tmp, F_OK); fail_unless(ret == -1, "special file %s exists, it shouldn't\n", tmp); talloc_free(tmp); } END_TEST static Suite *files_suite(void) { Suite *s = suite_create("files_suite"); TCase *tc_files = tcase_create("files"); tcase_add_checked_fixture(tc_files, setup_files_test, teardown_files_test); tcase_add_test(tc_files, test_remove_tree); tcase_add_test(tc_files, test_simple_copy); tcase_add_test(tc_files, test_copy_symlink); tcase_add_test(tc_files, test_copy_node); suite_add_tcase(s, tc_files); return s; } int main(int argc, const char *argv[]) { int number_failed; int opt; poptContext pc; int debug = 0; struct poptOption long_options[] = { POPT_AUTOHELP { "debug-level", 'd', POPT_ARG_INT, &debug, 0, "Set debug level", NULL }, POPT_TABLEEND }; /* Set debug level to invalid value so we can deside if -d 0 was used. */ debug_level = SSSDBG_INVALID; pc = poptGetContext(argv[0], argc, (const char **) argv, long_options, 0); while((opt = poptGetNextOpt(pc)) != -1) { fprintf(stderr, "\nInvalid option %s: %s\n\n", poptBadOption(pc, 0), poptStrerror(opt)); poptPrintUsage(pc, stderr, 0); return 1; } poptFreeContext(pc); DEBUG_INIT(debug); tests_set_cwd(); Suite *s = files_suite(); SRunner *sr = srunner_create(s); /* If CK_VERBOSITY is set, use that, otherwise it defaults to CK_NORMAL */ srunner_run_all(sr, CK_ENV); number_failed = srunner_ntests_failed(sr); srunner_free(sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }