View Single Post
  #1 (permalink)  
Old 07-08-2010, 01:26 PM
raidzero's Avatar
raidzero
N00b
Offline
Location: PPCG
 
Join Date: Dec 2008
Posts: 2,193
Reputation: 5220
raidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the communityraidzero is a trusted member of the community
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Send a message via MSN to raidzero
FROYO Bypass Exchange Server Policy

First - I take no responsibility if your phone is stolen and all your company secrets get stolen. I have edited the Email.apk to not do anything when asked to set a policy. You will need root to use this, and it only works on Froyo. This was made from the Sapphire email apk.

How?

I decompiled the apk with apktool. I then looked onlien and found the source code for the email app. Within that I found the securitypolicy.java file. I opened it up and compared it to the SecurityPolicy.smali file that apktool made for me.

I found the code in smali and simply changed one "True" to "False", or 1 to 0 (line 151 in java, or 523 in smali). I then rebuilt the apk and lo and behold, no security policy.

Note - I only did this because my exchange policy does not work on Froyo, I am fine with having a policy I just wanted email to work at all, and touchdown basically sucked.

Thanks go to cvpcs, sniffle, and rotordroid for the tips.

I LOVE OPEN SOURCE

JAVA excerpt:
Code:
127        boolean policiesFound = false;
128
129   int minPasswordLength = Integer.MIN_VALUE;
130       int passwordMode = Integer.MIN_VALUE;
131        int maxPasswordFails = Integer.MAX_VALUE;
132        int maxScreenLockTime = Integer.MAX_VALUE;
133       boolean requireRemoteWipe = false;
134
135        Cursor c = mContext.getContentResolver().query(Account.CONTENT_URI,
136               ACCOUNT_SECURITY_PROJECTION, WHERE_ACCOUNT_SECURITY_NONZERO, null, null);
137        try {
138           while (c.moveToNext()) {
139                int flags = c.getInt(ACCOUNT_SECURITY_COLUMN_FLAGS);
140                if (flags != 0) {
141                   PolicySet p = new PolicySet(flags);
142                    minPasswordLength = Math.max(p.mMinPasswordLength, minPasswordLength);
143                    passwordMode  = Math.max(p.mPasswordMode, passwordMode);
144                    if (p.mMaxPasswordFails > 0) {
145                        maxPasswordFails = Math.min(p.mMaxPasswordFails, maxPasswordFails);
146                    }
147                    if (p.mMaxScreenLockTime > 0) {
148                        maxScreenLockTime = Math.min(p.mMaxScreenLockTime, maxScreenLockTime);
149                    }
150                    requireRemoteWipe |= p.mRequireRemoteWipe;
151                    policiesFound = true; //*CHANGE TO FALSE IN SMALI
152                }
153            }
SMALI excerpt:
Code:
520    or-int/2addr v5, v0
521
522    .line 151
523    const/4 v13, 0x0 //*WAS 0x1
524
525    goto :goto_0
Again - Froyo only. Not sure about other roms but since sapphire is built from AOSP and not modified it should work for all froyo roms
Attached Files
File Type: zip RZ_Froyo_Email_bypassPolicy.zip (722.2 KB, 38 views) Click for barcode!
__________________
Reply With Quote
This post has been thanked 1 times.