Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
8e82524e
Commit
8e82524e
authored
Aug 17, 2008
by
Matt Colyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhance the usability of initconf, by giving more feedback to the user.
parent
495dd184
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
18 deletions
+65
-18
configure.ac
configure.ac
+1
-0
Makefile.am
src/Makefile.am
+3
-0
initconf.c
src/initconf.c
+61
-18
No files found.
configure.ac
View file @
8e82524e
...
@@ -14,6 +14,7 @@ AC_PROG_CC
...
@@ -14,6 +14,7 @@ AC_PROG_CC
PKG_CHECK_MODULES(libxml2, libxml-2.0 >= 2.6.30)
PKG_CHECK_MODULES(libxml2, libxml-2.0 >= 2.6.30)
PKG_CHECK_MODULES(libusb, libusb >= 0.1.12)
PKG_CHECK_MODULES(libusb, libusb >= 0.1.12)
PKG_CHECK_MODULES(libglib2, glib-2.0 >= 2.14.1)
PKG_CHECK_MODULES(libglib2, glib-2.0 >= 2.14.1)
PKG_CHECK_MODULES(libgthread2, gthread-2.0 >= 2.14.1)
PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3)
PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3)
PKG_CHECK_MODULES(libfuse, fuse >= 2.7.0)
PKG_CHECK_MODULES(libfuse, fuse >= 2.7.0)
...
...
src/Makefile.am
View file @
8e82524e
...
@@ -4,4 +4,7 @@ AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libfuse_LIBS) $(l
...
@@ -4,4 +4,7 @@ AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libfuse_LIBS) $(l
bin_PROGRAMS
=
iphoneclient ifuse libiphone-initconf
bin_PROGRAMS
=
iphoneclient ifuse libiphone-initconf
iphoneclient_SOURCES
=
usbmux.c main.c iphone.c plist.c lockdown.c AFC.c userpref.c
iphoneclient_SOURCES
=
usbmux.c main.c iphone.c plist.c lockdown.c AFC.c userpref.c
ifuse_SOURCES
=
ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c
ifuse_SOURCES
=
ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c
libiphone_initconf_SOURCES
=
initconf.c userpref.c
libiphone_initconf_SOURCES
=
initconf.c userpref.c
libiphone_initconf_CFLAGS
=
$(libgthread2_CFLAGS)
libiphone_initconf_LDFLAGS
=
$(libgthread2_LIBS)
src/initconf.c
View file @
8e82524e
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <gnutls/x509.h>
#include <glib.h>
#include <glib.h>
...
@@ -51,21 +52,46 @@ char *lockdownd_generate_hostid() {
...
@@ -51,21 +52,46 @@ char *lockdownd_generate_hostid() {
return
hostid
;
return
hostid
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
void
generate_key
(
gpointer
key
){
gnutls_x509_privkey_generate
(
*
((
gnutls_x509_privkey_t
*
)
key
),
GNUTLS_PK_RSA
,
2048
,
0
);
g_thread_exit
(
0
);
}
printf
(
"This program generates keys required to connect with the iPhone
\n
"
);
void
progress_bar
(
gpointer
mutex
){
printf
(
"It only needs to be run ONCE.
\n\n
"
)
;
const
char
*
spinner
=
"|/-
\\
|/-
\\
"
;
printf
(
"Additionally it may take several minutes to run, please be patient.
\n\n
"
)
;
int
i
=
0
;
gnutls_global_init
();
while
(
!
g_static_mutex_trylock
((
GStaticMutex
*
)
mutex
)){
usleep
(
500000
);
printf
(
"Generating root key... %c
\r
"
,
spinner
[
i
++
]);
fflush
(
stdout
);
if
(
i
>
8
)
i
=
0
;
}
printf
(
"Generating key... done
\n
"
);
g_thread_exit
(
0
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
GThread
*
progress_thread
,
*
key_thread
;
GError
*
err
;
static
GStaticMutex
mutex
=
G_STATIC_MUTEX_INIT
;
char
*
host_id
=
NULL
;
char
*
host_id
=
NULL
;
gnutls_x509_privkey_t
root_privkey
;
gnutls_x509_privkey_t
root_privkey
;
gnutls_x509_privkey_t
host_privkey
;
gnutls_x509_privkey_t
host_privkey
;
gnutls_x509_crt_t
root_cert
;
gnutls_x509_crt_t
root_cert
;
gnutls_x509_crt_t
host_cert
;
gnutls_x509_crt_t
host_cert
;
// Create the thread
if
(
!
g_thread_supported
()){
g_thread_init
(
NULL
);
}
gnutls_global_init
();
printf
(
"This program generates keys required to connect with the iPhone
\n
"
);
printf
(
"It only needs to be run ONCE.
\n\n
"
);
printf
(
"Additionally it may take several minutes to run, please be patient.
\n\n
"
);
gnutls_x509_privkey_init
(
&
root_privkey
);
gnutls_x509_privkey_init
(
&
root_privkey
);
gnutls_x509_privkey_init
(
&
host_privkey
);
gnutls_x509_privkey_init
(
&
host_privkey
);
...
@@ -73,19 +99,36 @@ int main(int argc, char *argv[]) {
...
@@ -73,19 +99,36 @@ int main(int argc, char *argv[]) {
gnutls_x509_crt_init
(
&
host_cert
);
gnutls_x509_crt_init
(
&
host_cert
);
/* generate HostID */
/* generate HostID */
//TODO
host_id
=
lockdownd_generate_hostid
();
host_id
=
lockdownd_generate_hostid
();
/* generate keys */
/* generate root key */
printf
(
"Generating root key..."
);
g_static_mutex_lock
(
&
mutex
);
fflush
(
stdout
);
if
((
key_thread
=
g_thread_create
((
GThreadFunc
)
generate_key
,
&
root_privkey
,
TRUE
,
&
err
))
==
NULL
)
{
gnutls_x509_privkey_generate
(
root_privkey
,
GNUTLS_PK_RSA
,
2048
,
0
);
printf
(
"Thread create failed: %s!!
\n
"
,
err
->
message
);
printf
(
"done
\n
"
);
g_error_free
(
err
)
;
}
printf
(
"Generating private key..."
);
if
((
progress_thread
=
g_thread_create
((
GThreadFunc
)
progress_bar
,
&
mutex
,
TRUE
,
&
err
))
==
NULL
)
{
fflush
(
stdout
);
printf
(
"Thread create failed: %s!!
\n
"
,
err
->
message
);
gnutls_x509_privkey_generate
(
host_privkey
,
GNUTLS_PK_RSA
,
2048
,
0
);
g_error_free
(
err
)
;
printf
(
"done
\n
"
);
}
g_thread_join
(
key_thread
);
g_static_mutex_unlock
(
&
mutex
);
g_thread_join
(
progress_thread
);
/* generate host key */
g_static_mutex_init
(
&
mutex
);
g_static_mutex_lock
(
&
mutex
);
if
((
key_thread
=
g_thread_create
((
GThreadFunc
)
generate_key
,
&
host_privkey
,
TRUE
,
&
err
))
==
NULL
)
{
printf
(
"Thread create failed: %s!!
\n
"
,
err
->
message
);
g_error_free
(
err
)
;
}
if
((
progress_thread
=
g_thread_create
((
GThreadFunc
)
progress_bar
,
&
mutex
,
TRUE
,
&
err
))
==
NULL
)
{
printf
(
"Thread create failed: %s!!
\n
"
,
err
->
message
);
g_error_free
(
err
)
;
}
g_thread_join
(
key_thread
);
g_static_mutex_unlock
(
&
mutex
);
g_thread_join
(
progress_thread
);
/* generate certificates */
/* generate certificates */
gnutls_x509_crt_set_key
(
root_cert
,
root_privkey
);
gnutls_x509_crt_set_key
(
root_cert
,
root_privkey
);
...
@@ -133,7 +176,7 @@ int main(int argc, char *argv[]) {
...
@@ -133,7 +176,7 @@ int main(int argc, char *argv[]) {
gnutls_x509_crt_export
(
root_cert
,
GNUTLS_X509_FMT_PEM
,
root_cert_pem
.
data
,
&
root_cert_pem
.
size
);
gnutls_x509_crt_export
(
root_cert
,
GNUTLS_X509_FMT_PEM
,
root_cert_pem
.
data
,
&
root_cert_pem
.
size
);
printf
(
"done
\n
"
);
printf
(
"done
\n
"
);
printf
(
"Generating
roo
t certificate..."
);
printf
(
"Generating
hos
t certificate..."
);
gnutls_x509_crt_export
(
host_cert
,
GNUTLS_X509_FMT_PEM
,
host_cert_pem
.
data
,
&
host_cert_pem
.
size
);
gnutls_x509_crt_export
(
host_cert
,
GNUTLS_X509_FMT_PEM
,
host_cert_pem
.
data
,
&
host_cert_pem
.
size
);
printf
(
"done
\n
"
);
printf
(
"done
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment