Hello,

I get this:
pkcs15-iasecc.c: In function ‘iasecc_file_convert_acls’:
pkcs15-iasecc.c:312: warning: initialization discards qualifiers from
pointer target type

The problem is the line:
                struct sc_acl_entry *acl = sc_file_get_acl_entry(file, ii);

If I change it to:
                const struct sc_acl_entry *acl = sc_file_get_acl_entry(file, 
ii);
I then get errors:
pkcs15-iasecc.c: In function ‘iasecc_file_convert_acls’:
pkcs15-iasecc.c:320: error: assignment of read-only location
pkcs15-iasecc.c:321: error: assignment of read-only location
pkcs15-iasecc.c:324: error: assignment of read-only location
pkcs15-iasecc.c:325: error: assignment of read-only location

This is because the iasecc_file_convert_acls() function _does_ change
the (const) structure returned by sc_file_get_acl_entry().

Complete function:
static int
iasecc_file_convert_acls(struct sc_context *ctx, struct sc_profile
*profile, struct sc_file *file)
{
        int ii;

        for (ii=0; ii<SC_MAX_AC_OPS;ii++)   {
                struct sc_acl_entry *acl = sc_file_get_acl_entry(file, ii);

                if (acl)   {
                        switch (acl->method)   {                                
                        case SC_AC_IDA:
                                LOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, 
"'IDA' not actually supported");
                        case SC_AC_SCB:
                                if ((acl->key_ref & IASECC_SCB_METHOD_MASK) ==
IASECC_SCB_METHOD_USER_AUTH)   {
here ->                         acl->method = SC_AC_SEN;
here ->                         acl->key_ref &= IASECC_SCB_METHOD_MASK_REF;
                                }
                                else if ((acl->key_ref & 
IASECC_SCB_METHOD_MASK) ==
IASECC_SCB_METHOD_SM)   {
here ->                         acl->method = SC_AC_PRO;
here ->                         acl->key_ref &= IASECC_SCB_METHOD_MASK_REF;
                                }
                        }
                }
        }

        return 0;
}


I don't know what is the proper way to fix this.

Bye

-- 
 Dr. Ludovic Rousseau
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to