Группа :: Система/Ядро и оборудование
Пакет: cryptsetup
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: cryptsetup-1.0.6-alt-const_types.patch
Скачать
Скачать
Miscellaneous fixes for const modifiers in types
--- lib/libcryptsetup.h.orig
+++ lib/libcryptsetup.h
@@ -67,7 +67,7 @@ int crypt_luksDump(struct crypt_options *options);
void crypt_get_error(char *buf, size_t size);
void crypt_put_options(struct crypt_options *options);
-const char *crypt_get_dir(void);
+char *crypt_get_dir(void);
#ifdef __cplusplus
}
--- lib/setup.c.orig
+++ lib/setup.c
@@ -111,7 +111,7 @@ static char *process_key(struct crypt_options *options, char *pass, int passLen)
/* key is coming from tty, fd or binary stdin */
if (options->hash) {
- if (hash(NULL, options->hash,
+ if (hash(NULL, (const char*) options->hash,
key, options->key_size,
pass, passLen) < 0)
{
@@ -312,7 +312,7 @@ static int __crypt_create_device(int reload, struct setup_backend *backend,
return -EINVAL;
}
- if (get_device_infos(options->device, &infos) < 0)
+ if (get_device_infos((const char*) options->device, &infos) < 0)
return -ENOTBLK;
if (!options->size) {
@@ -331,7 +331,7 @@ static int __crypt_create_device(int reload, struct setup_backend *backend,
if (infos.readonly)
options->flags |= CRYPT_FLAG_READONLY;
- get_key("Enter passphrase: ", &key, &keyLen, options->key_size, options->key_file, options->passphrase_fd, options->timeout, options->flags);
+ get_key("Enter passphrase: ", &key, &keyLen, options->key_size, (const char*) options->key_file, options->passphrase_fd, options->timeout, options->flags);
if (!key) {
set_error("Key reading error");
return -ENOENT;
@@ -385,7 +385,7 @@ static int __crypt_resize_device(int details, struct setup_backend *backend,
if (r < 0)
return r;
- if (get_device_infos(tmp.device, &infos) < 0)
+ if (get_device_infos((const char*) tmp.device, &infos) < 0)
return -EINVAL;
if (!options->size) {
@@ -441,7 +441,7 @@ static int __crypt_luks_format(int arg, struct setup_backend *backend, struct cr
int PBKDF2perSecond;
int keyIndex;
- if (!LUKS_device_ready(options->device, O_RDWR | O_EXCL))
+ if (!LUKS_device_ready((const char*) options->device, O_RDWR | O_EXCL))
return -ENOTBLK;
mk = LUKS_generate_masterkey(options->key_size);
@@ -465,7 +465,7 @@ static int __crypt_luks_format(int arg, struct setup_backend *backend, struct cr
printoffset(uuid);
#endif
- r = parse_into_name_and_mode(options->cipher, cipherName, cipherMode);
+ r = parse_into_name_and_mode((const char*) options->cipher, cipherName, cipherMode);
if(r < 0) return r;
r = LUKS_generate_phdr(&header,mk,cipherName, cipherMode,LUKS_STRIPES, options->align_payload);
@@ -484,17 +484,17 @@ static int __crypt_luks_format(int arg, struct setup_backend *backend, struct cr
#ifdef LUKS_DEBUG
logger(options->icb->log,CRYPT_LOG_ERROR, "pitr %d\n", header.keyblock[0].passwordIterations);
#endif
- get_key("Enter LUKS passphrase: ",&password,&passwordLen, 0, options->new_key_file, options->passphrase_fd, options->timeout, options->flags);
+ get_key("Enter LUKS passphrase: ",&password,&passwordLen, 0, (const char*) options->new_key_file, options->passphrase_fd, options->timeout, options->flags);
if(!password) {
r = -EINVAL; goto out;
}
/* Wipe first 8 sectors - fs magic numbers etc. */
- r = wipe_device_header(options->device, 8);
+ r = wipe_device_header((const char*) options->device, 8);
if(r < 0) goto out;
/* Set key, also writes phdr */
- r = LUKS_set_key(options->device, keyIndex, password, passwordLen, &header, mk, backend);
+ r = LUKS_set_key((const char*) options->device, keyIndex, password, passwordLen, &header, mk, backend);
if(r < 0) goto out;
r = 0;
@@ -525,10 +525,10 @@ static int __crypt_luks_open(int arg, struct setup_backend *backend, struct cryp
return -EEXIST;
}
- if (!LUKS_device_ready(options->device, O_RDONLY | excl))
+ if (!LUKS_device_ready((const char*) options->device, O_RDONLY | excl))
return -ENOTBLK;
- if (get_device_infos(options->device, &infos) < 0) {
+ if (get_device_infos((const char*) options->device, &infos) < 0) {
set_error("Can't get device information.\n");
return -ENOTBLK;
}
@@ -542,7 +542,7 @@ static int __crypt_luks_open(int arg, struct setup_backend *backend, struct cryp
start:
mk=NULL;
- if(get_key(prompt, &password, &passwordLen, 0, options->key_file, options->passphrase_fd, options->timeout, options->flags))
+ if(get_key(prompt, &password, &passwordLen, 0, (const char*) options->key_file, options->passphrase_fd, options->timeout, options->flags))
tries--;
else
tries = 0;
@@ -551,7 +551,7 @@ start:
r = -EINVAL; goto out;
}
- r = LUKS_open_any_key(options->device, password, passwordLen, &hdr, &mk, backend);
+ r = LUKS_open_any_key((const char*) options->device, password, passwordLen, &hdr, &mk, backend);
if (r == -EPERM)
set_error("No key available with this passphrase.\n");
if (r < 0)
@@ -604,10 +604,10 @@ static int __crypt_luks_add_key(int arg, struct setup_backend *backend, struct c
struct luks_phdr hdr;
char *password=NULL; unsigned int passwordLen;
unsigned int keyIndex;
- const char *device = options->device;
+ const char *device = (const char*) options->device;
int r;
- if (!LUKS_device_ready(options->device, O_RDWR))
+ if (!LUKS_device_ready((const char *) options->device, O_RDWR))
return -ENOTBLK;
r = LUKS_read_phdr(device, &hdr);
@@ -623,7 +623,7 @@ static int __crypt_luks_add_key(int arg, struct setup_backend *backend, struct c
&password,
&passwordLen,
0,
- options->key_file,
+ (const char*) options->key_file,
options->passphrase_fd,
options->timeout,
options->flags & ~(CRYPT_FLAG_VERIFY | CRYPT_FLAG_VERIFY_IF_POSSIBLE));
@@ -644,7 +644,7 @@ static int __crypt_luks_add_key(int arg, struct setup_backend *backend, struct c
&password,
&passwordLen,
0,
- options->new_key_file,
+ (const char*) options->new_key_file,
options->passphrase_fd,
options->timeout,
options->flags);
@@ -670,16 +670,16 @@ static int luks_remove_helper(int arg, struct setup_backend *backend, struct cry
struct luks_phdr hdr;
char *password=NULL;
unsigned int passwordLen;
- const char *device = options->device;
+ const char *device = (const char*) options->device;
int keyIndex;
int openedIndex;
int r, last_slot;
- if (!LUKS_device_ready(options->device, O_RDWR))
+ if (!LUKS_device_ready((const char*) options->device, O_RDWR))
return -ENOTBLK;
if(supply_it) {
- get_key("Enter LUKS passphrase to be deleted: ",&password,&passwordLen, 0, options->new_key_file, options->passphrase_fd, options->timeout, options->flags);
+ get_key("Enter LUKS passphrase to be deleted: ",&password,&passwordLen, 0, (const char*) options->new_key_file, options->passphrase_fd, options->timeout, options->flags);
if(!password) {
r = -EINVAL; goto out;
}
@@ -694,14 +694,14 @@ static int luks_remove_helper(int arg, struct setup_backend *backend, struct cry
keyIndex = options->key_slot;
}
- last_slot = LUKS_is_last_keyslot(options->device, keyIndex);
+ last_slot = LUKS_is_last_keyslot((const char*) options->device, keyIndex);
if(last_slot && !(options->icb->yesDialog(_("This is the last keyslot. Device will become unusable after purging this key.")))) {
r = -EINVAL; goto out;
}
if(options->flags & CRYPT_FLAG_VERIFY_ON_DELKEY) {
options->flags &= ~CRYPT_FLAG_VERIFY_ON_DELKEY;
- get_key("Enter any remaining LUKS passphrase: ",&password,&passwordLen, 0, options->key_file, options->passphrase_fd, options->timeout, options->flags);
+ get_key("Enter any remaining LUKS passphrase: ",&password,&passwordLen, 0, (const char*) options->key_file, options->passphrase_fd, options->timeout, options->flags);
if(!password) {
r = -EINVAL; goto out;
}
@@ -833,7 +833,7 @@ int crypt_luksUUID(struct crypt_options *options)
struct luks_phdr hdr;
int r;
- r = LUKS_read_phdr(options->device,&hdr);
+ r = LUKS_read_phdr((const char*)options->device,&hdr);
if(r < 0) return r;
options->icb->log(CRYPT_LOG_NORMAL,hdr.uuid);
@@ -844,7 +844,7 @@ int crypt_luksUUID(struct crypt_options *options)
int crypt_isLuks(struct crypt_options *options)
{
struct luks_phdr hdr;
- return LUKS_read_phdr(options->device,&hdr);
+ return LUKS_read_phdr((const char*) options->device,&hdr);
}
int crypt_luksDump(struct crypt_options *options)
@@ -852,7 +852,7 @@ int crypt_luksDump(struct crypt_options *options)
struct luks_phdr hdr;
int r,i;
- r = LUKS_read_phdr(options->device,&hdr);
+ r = LUKS_read_phdr((const char*) options->device,&hdr);
if(r < 0) return r;
logger(options, CRYPT_LOG_NORMAL, "LUKS header information for %s\n\n",options->device);
@@ -930,7 +930,7 @@ void crypt_set_default_backend(const char *backend)
default_backend = NULL;
}
-const char *crypt_get_dir(void)
+char *crypt_get_dir(void)
{
struct setup_backend *backend;
const char *dir;
@@ -943,7 +943,7 @@ const char *crypt_get_dir(void)
put_setup_backend(backend);
- return dir;
+ return (char*) dir;
}
// Local Variables:
--- lib/libdevmapper.c.orig 2009-11-15 03:35:13 +0300
+++ lib/libdevmapper.c 2009-11-15 03:38:24 +0300
@@ -208,8 +208,8 @@
if (!dm_task_run(dmt))
goto error;
- if (!_dm_simple(DM_DEVICE_RESUME, options->name)) {
- _dm_simple(DM_DEVICE_CLEAR, options->name);
+ if (!_dm_simple(DM_DEVICE_RESUME, (const char*) options->name)) {
+ _dm_simple(DM_DEVICE_CLEAR, (const char*) options->name);
goto error;
}
@@ -239,7 +239,7 @@
}
do {
- r = _dm_simple(DM_DEVICE_REMOVE, options->name) ? 0 : -EINVAL;
+ r = _dm_simple(DM_DEVICE_REMOVE, (const char*) options->name) ? 0 : -EINVAL;
if (--retries)
sleep(1);
} while (r == -EINVAL && retries);
@@ -282,7 +282,7 @@
goto out;
#ifdef DM_READ_AHEAD_MINIMUM_FLAG
- if (_dev_read_ahead(options->device, &read_ahead) &&
+ if (_dev_read_ahead((const char*) options->device, &read_ahead) &&
!dm_task_set_read_ahead(dmt, read_ahead, DM_READ_AHEAD_MINIMUM_FLAG))
goto out;
#endif