i tried. apparently, it is more complicated than just changing the password value. some related info must be encoded elsewhere in the db because my attempts to change the password did not seem to be understood by ms access.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the method below should modify the database password (as far as the data jackcess reads). however, i'm pretty sure access does something with the ACLs based on the password, and that just changing the password value itself won't work.
public void setDatabasePassword(String newPassword) throws IOException
{
_pageChannel.readPage(_buffer, 0);
ByteBufferpwdBB=Column.encodeUncompressedText(newPassword,getCharset());if(pwdBB.remaining()>_format.SIZE_PASSWORD){thrownewIllegalArgumentException("Password too long");}byte[]pwdBytes=newbyte[_format.SIZE_PASSWORD];pwdBB.get(pwdBytes,0,pwdBB.remaining());//re-maskpasswordusingextrapasswordmaskifnecessary(theextra//passwordmaskisgeneratedfromthedatabasecreationdatestoredin//theheader)byte[]pwdMask=getPasswordMask(_buffer,_format);if(pwdMask!=null){for(inti=0;i<pwdBytes.length;++i){pwdBytes[i]^=pwdMask[i % pwdMask.length];}}_buffer.position(_format.OFFSET_PASSWORD);_buffer.put(pwdBytes);_pageChannel.writePage(_buffer,0);
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i tried. apparently, it is more complicated than just changing the password value. some related info must be encoded elsewhere in the db because my attempts to change the password did not seem to be understood by ms access.
Access seems to want "open in exclusive mode" in order to set a password. Don't know if that is a useful clue.
Do you mind make codes that you have available here anyway.
Thanks for trying. Appreciated the effort.
i'll see if i can put back together the code i had for modifying the password.
the method below should modify the database password (as far as the data jackcess reads). however, i'm pretty sure access does something with the ACLs based on the password, and that just changing the password value itself won't work.
public void setDatabasePassword(String newPassword) throws IOException
{
_pageChannel.readPage(_buffer, 0);
}
Thanks. It worked (as far as setting the password "field").
is that useful to you? does ms money check the password differently?
Ticket moved from /p/jackcess/bugs/76/