Merge branch 'fix/alpm-user-does-not-exist' into 'master'
Add an error message if the sandbox user account does not exist See merge request pacman/pacman!250
This commit is contained in:
commit
00a93da8e3
5 changed files with 13 additions and 8 deletions
|
@ -153,7 +153,7 @@ int SYMEXPORT alpm_db_update(alpm_handle_t *handle, alpm_list_t *dbs, int force)
|
||||||
|
|
||||||
syncpath = get_sync_dir(handle);
|
syncpath = get_sync_dir(handle);
|
||||||
ASSERT(syncpath != NULL, return -1);
|
ASSERT(syncpath != NULL, return -1);
|
||||||
temporary_syncpath = _alpm_temporary_download_dir_setup(syncpath, handle->sandboxuser);
|
temporary_syncpath = _alpm_temporary_download_dir_setup(handle, syncpath);
|
||||||
ASSERT(temporary_syncpath != NULL, FREE(syncpath); return -1);
|
ASSERT(temporary_syncpath != NULL, FREE(syncpath); return -1);
|
||||||
|
|
||||||
/* make sure we have a sane umask */
|
/* make sure we have a sane umask */
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ int SYMEXPORT alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls,
|
||||||
|
|
||||||
/* find a valid cache dir to download to */
|
/* find a valid cache dir to download to */
|
||||||
cachedir = _alpm_filecache_setup(handle);
|
cachedir = _alpm_filecache_setup(handle);
|
||||||
temporary_cachedir = _alpm_temporary_download_dir_setup(cachedir, handle->sandboxuser);
|
temporary_cachedir = _alpm_temporary_download_dir_setup(handle, cachedir);
|
||||||
ASSERT(temporary_cachedir != NULL, return -1);
|
ASSERT(temporary_cachedir != NULL, return -1);
|
||||||
|
|
||||||
for(i = urls; i; i = i->next) {
|
for(i = urls; i; i = i->next) {
|
||||||
|
|
|
@ -780,7 +780,7 @@ static int download_files(alpm_handle_t *handle)
|
||||||
alpm_list_t *payloads = NULL;
|
alpm_list_t *payloads = NULL;
|
||||||
|
|
||||||
cachedir = _alpm_filecache_setup(handle);
|
cachedir = _alpm_filecache_setup(handle);
|
||||||
temporary_cachedir = _alpm_temporary_download_dir_setup(cachedir, handle->sandboxuser);
|
temporary_cachedir = _alpm_temporary_download_dir_setup(handle, cachedir);
|
||||||
if(temporary_cachedir == NULL) {
|
if(temporary_cachedir == NULL) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
|
@ -949,17 +949,22 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
|
||||||
/** Create a temporary directory under the supplied directory.
|
/** Create a temporary directory under the supplied directory.
|
||||||
* The new directory is writable by the download user, and will be
|
* The new directory is writable by the download user, and will be
|
||||||
* removed after the download operation has completed.
|
* removed after the download operation has completed.
|
||||||
|
* @param handle the context handle
|
||||||
* @param dir existing sync or cache directory
|
* @param dir existing sync or cache directory
|
||||||
* @param user download user name
|
|
||||||
* @return pointer to a sub-directory writable by the download user inside the existing directory.
|
* @return pointer to a sub-directory writable by the download user inside the existing directory.
|
||||||
*/
|
*/
|
||||||
char *_alpm_temporary_download_dir_setup(const char *dir, const char *user)
|
char *_alpm_temporary_download_dir_setup(alpm_handle_t *handle, const char *dir)
|
||||||
{
|
{
|
||||||
struct passwd const *pw = NULL;
|
struct passwd const *pw = NULL;
|
||||||
|
|
||||||
ASSERT(dir != NULL, return NULL);
|
ASSERT(dir != NULL, return NULL);
|
||||||
if(user != NULL) {
|
if(handle->sandboxuser != NULL) {
|
||||||
ASSERT((pw = getpwnam(user)) != NULL, return NULL);
|
pw = getpwnam(handle->sandboxuser);
|
||||||
|
if ( pw == NULL ) {
|
||||||
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
|
_("could not create temporary download dir: user '%s' does not exist\n"), handle->sandboxuser);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char template[] = "download-XXXXXX";
|
const char template[] = "download-XXXXXX";
|
||||||
|
|
|
@ -139,7 +139,7 @@ char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename);
|
||||||
/* Checks whether a file exists in cache */
|
/* Checks whether a file exists in cache */
|
||||||
int _alpm_filecache_exists(alpm_handle_t *handle, const char *filename);
|
int _alpm_filecache_exists(alpm_handle_t *handle, const char *filename);
|
||||||
const char *_alpm_filecache_setup(alpm_handle_t *handle);
|
const char *_alpm_filecache_setup(alpm_handle_t *handle);
|
||||||
char *_alpm_temporary_download_dir_setup(const char *dir, const char *user);
|
char *_alpm_temporary_download_dir_setup(alpm_handle_t *handle, const char *dir);
|
||||||
void _alpm_remove_temporary_download_dir(const char *dir);
|
void _alpm_remove_temporary_download_dir(const char *dir);
|
||||||
|
|
||||||
/* Unlike many uses of alpm_pkgvalidation_t, _alpm_test_checksum expects
|
/* Unlike many uses of alpm_pkgvalidation_t, _alpm_test_checksum expects
|
||||||
|
|
Loading…
Add table
Reference in a new issue