diff options
Diffstat (limited to 'src/lockdown.c')
| -rw-r--r-- | src/lockdown.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/lockdown.c b/src/lockdown.c index ae077b7..0957fa2 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -39,34 +39,7 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = { | |||
| 39 | {0, 0, 0} | 39 | {0, 0, 0} |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | int get_rand(int min, int max) | ||
| 43 | { | ||
| 44 | int retval = (rand() % (max - min)) + min; | ||
| 45 | return retval; | ||
| 46 | } | ||
| 47 | 42 | ||
| 48 | /** Generates a valid HostID (which is actually a UUID). | ||
| 49 | * | ||
| 50 | * @param A null terminated string containing a valid HostID. | ||
| 51 | */ | ||
| 52 | char *lockdownd_generate_hostid() | ||
| 53 | { | ||
| 54 | char *hostid = (char *) malloc(sizeof(char) * 37); // HostID's are just UUID's, and UUID's are 36 characters long | ||
| 55 | const char *chars = "ABCDEF0123456789"; | ||
| 56 | srand(time(NULL)); | ||
| 57 | int i = 0; | ||
| 58 | |||
| 59 | for (i = 0; i < 36; i++) { | ||
| 60 | if (i == 8 || i == 13 || i == 18 || i == 23) { | ||
| 61 | hostid[i] = '-'; | ||
| 62 | continue; | ||
| 63 | } else { | ||
| 64 | hostid[i] = chars[get_rand(0, 16)]; | ||
| 65 | } | ||
| 66 | } | ||
| 67 | hostid[36] = '\0'; // make it a real string | ||
| 68 | return hostid; | ||
| 69 | } | ||
| 70 | 43 | ||
| 71 | /** Creates a lockdownd client for the give iPhone. | 44 | /** Creates a lockdownd client for the give iPhone. |
| 72 | * | 45 | * |
