diff options
Diffstat (limited to 'src/job-manager.c')
| -rw-r--r-- | src/job-manager.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/job-manager.c b/src/job-manager.c index bf3b0df..8044b7f 100644 --- a/src/job-manager.c +++ b/src/job-manager.c @@ -35,6 +35,7 @@ #define DEFAULT_DATA_DIR_MODE S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH +#define AUTH_PASSWD_FILE ".htpasswd" typedef struct { @@ -268,9 +269,34 @@ build_tree (TGallerySetup *setup, } } + /* Cleanup for auth */ + if (items->auth_type != AUTH_TYPE_NONE) { + /* We're appending by default to preserve user .htaccess file supplied as an extra file. + * Let's remove the target file to prevent endless appending when overwriting the dst structure. */ + s1 = g_build_filename (path_info->dest_dir, ".htaccess", NULL); + unlink (s1); + g_free (s1); + } + /* Copy extra files */ mirror_files (setup, items->extra_files, path_info->src_dir, path_info->dest_dir, " Copying extra files: "); + /* Write auth files */ + if (items->auth_type != AUTH_TYPE_NONE) { + if (setup->verbose) printf (" Writing auth files: "); + s1 = g_build_filename (path_info->dest_dir, AUTH_PASSWD_FILE, NULL); + if (write_auth_passwd_file (setup, s1, items) && setup->verbose) + printf ("%s ", AUTH_PASSWD_FILE); + g_free (s1); + s1 = g_build_filename (path_info->dest_dir, ".htaccess", NULL); + s2 = g_build_filename (setup->location_local_path, path_info->album_path, AUTH_PASSWD_FILE, NULL); + if (write_auth_htaccess_file (setup, s1, s2, items) && setup->verbose) + printf ("%s ", ".htaccess"); + g_free (s2); + g_free (s1); + if (setup->verbose) printf ("\n"); + } + /* Prepare target image directories */ for (l = g_list_first (setup->design->image_sizes); l; l = g_list_next (l)) { image_size = l->data; |
