diff options
Diffstat (limited to 'src/ifuse.c')
| -rw-r--r-- | src/ifuse.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ifuse.c b/src/ifuse.c index eb124af..1cfa48d 100644 --- a/src/ifuse.c +++ b/src/ifuse.c | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include "AFC.h" | 17 | #include "AFC.h" |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | AFClient *afc; | 20 | AFClient *afc = NULL; |
| 21 | GHashTable *file_handles; | 21 | GHashTable *file_handles; |
| 22 | int fh_index = 0; | 22 | int fh_index = 0; |
| 23 | 23 | ||
| @@ -85,7 +85,7 @@ static int ifuse_read(const char *path, char *buf, size_t size, off_t offset, | |||
| 85 | return bytes; | 85 | return bytes; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | void ifuse_init(struct fuse_conn_info *conn) { | 88 | void *ifuse_init(struct fuse_conn_info *conn) { |
| 89 | char *response = (char*)malloc(sizeof(char) * 2048); | 89 | char *response = (char*)malloc(sizeof(char) * 2048); |
| 90 | int bytes = 0, port = 0, i = 0; | 90 | int bytes = 0, port = 0, i = 0; |
| 91 | 91 | ||
| @@ -94,27 +94,29 @@ void ifuse_init(struct fuse_conn_info *conn) { | |||
| 94 | iPhone *phone = get_iPhone(); | 94 | iPhone *phone = get_iPhone(); |
| 95 | if (!phone){ | 95 | if (!phone){ |
| 96 | fprintf(stderr, "No iPhone found, is it connected?\n"); | 96 | fprintf(stderr, "No iPhone found, is it connected?\n"); |
| 97 | return -1; | 97 | return NULL; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | lockdownd_client *control = new_lockdownd_client(phone); | 100 | lockdownd_client *control = new_lockdownd_client(phone); |
| 101 | if (!lockdownd_hello(control)) { | 101 | if (!lockdownd_hello(control)) { |
| 102 | fprintf(stderr, "Something went wrong in the lockdownd client.\n"); | 102 | fprintf(stderr, "Something went wrong in the lockdownd client.\n"); |
| 103 | return -1; | 103 | return NULL; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | //if (!lockdownd_start_SSL_session(control, "29942970-207913891623273984")) { | 106 | //if (!lockdownd_start_SSL_session(control, "29942970-207913891623273984")) { |
| 107 | fprintf(stderr, "Something went wrong in GnuTLS.\n"); | 107 | fprintf(stderr, "Something went wrong in GnuTLS.\n"); |
| 108 | return -1; | 108 | return NULL; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | port = lockdownd_start_service(control, "com.apple.afc"); | 111 | port = lockdownd_start_service(control, "com.apple.afc"); |
| 112 | if (!port) { | 112 | if (!port) { |
| 113 | fprintf(stderr, "Something went wrong when starting AFC."); | 113 | fprintf(stderr, "Something went wrong when starting AFC."); |
| 114 | return NULL; | ||
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | afc = afc_connect(phone, 3432, port); | 117 | afc = afc_connect(phone, 3432, port); |
| 117 | 118 | ||
| 119 | return afc; | ||
| 118 | } | 120 | } |
| 119 | 121 | ||
| 120 | void ifuse_cleanup() { | 122 | void ifuse_cleanup() { |
