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
f492fa82
Commit
f492fa82
authored
Aug 01, 2008
by
Matt Colyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few cleanups, got rid of global afc variable.
parent
d05ae226
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
ifuse.c
src/ifuse.c
+14
-7
userpref.c
src/userpref.c
+3
-3
No files found.
src/ifuse.c
View file @
f492fa82
...
...
@@ -37,8 +37,6 @@
#include "AFC.h"
#include "userpref.h"
AFClient
*
afc
=
NULL
;
GHashTable
*
file_handles
;
int
fh_index
=
0
;
...
...
@@ -47,6 +45,7 @@ int debug = 0;
static
int
ifuse_getattr
(
const
char
*
path
,
struct
stat
*
stbuf
)
{
int
res
=
0
;
AFCFile
*
file
;
AFClient
*
afc
=
fuse_get_context
()
->
private_data
;
memset
(
stbuf
,
0
,
sizeof
(
struct
stat
));
file
=
afc_get_file_info
(
afc
,
path
);
...
...
@@ -66,6 +65,7 @@ static int ifuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
off_t
offset
,
struct
fuse_file_info
*
fi
)
{
int
i
;
char
**
dirs
,
**
filename
;
AFClient
*
afc
=
fuse_get_context
()
->
private_data
;
dirs
=
afc_get_dir_list
(
afc
,
path
);
for
(
i
=
0
;
strcmp
(
dirs
[
i
],
""
);
i
++
)
{
...
...
@@ -79,6 +79,7 @@ static int ifuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
static
int
ifuse_open
(
const
char
*
path
,
struct
fuse_file_info
*
fi
)
{
AFCFile
*
file
;
AFClient
*
afc
=
fuse_get_context
()
->
private_data
;
if
((
fi
->
flags
&
3
)
!=
O_RDONLY
)
return
-
EACCES
;
...
...
@@ -96,6 +97,7 @@ static int ifuse_read(const char *path, char *buf, size_t size, off_t offset,
struct
fuse_file_info
*
fi
)
{
int
bytes
;
AFCFile
*
file
;
AFClient
*
afc
=
fuse_get_context
()
->
private_data
;
file
=
g_hash_table_lookup
(
file_handles
,
&
(
fi
->
fh
));
if
(
!
file
){
...
...
@@ -111,7 +113,10 @@ void *ifuse_init(struct fuse_conn_info *conn) {
char
*
response
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
2048
);
int
bytes
=
0
,
port
=
0
,
i
=
0
;
char
*
host_id
=
NULL
;
AFClient
*
afc
=
NULL
;
conn
->
async_read
=
0
;
file_handles
=
g_hash_table_new
(
g_int_hash
,
g_int_equal
);
iPhone
*
phone
=
get_iPhone
();
...
...
@@ -127,8 +132,8 @@ void *ifuse_init(struct fuse_conn_info *conn) {
}
host_id
=
get_host_id
();
if
(
host_id
&&
!
lockdownd_start_SSL_session
(
control
,
host_id
))
{
fprintf
(
stderr
,
"Something went wrong in GnuTLS.
\n
"
);
if
(
host_id
&&
!
lockdownd_start_SSL_session
(
control
,
host_id
)
||
!
host_id
)
{
fprintf
(
stderr
,
"Something went wrong in GnuTLS.
Is your HostID configured in .config/libiphone/libiphonerc?
\n
"
);
return
NULL
;
}
free
(
host_id
);
...
...
@@ -145,9 +150,11 @@ void *ifuse_init(struct fuse_conn_info *conn) {
return
afc
;
}
void
ifuse_cleanup
()
{
free_iPhone
(
afc
->
phone
);
afc_disconnect
(
afc
);
void
ifuse_cleanup
(
AFClient
*
afc
)
{
if
(
afc
)
{
free_iPhone
(
afc
->
phone
);
afc_disconnect
(
afc
);
}
}
static
struct
fuse_operations
ifuse_oper
=
{
...
...
src/userpref.c
View file @
f492fa82
...
...
@@ -32,14 +32,14 @@ char* get_host_id()
gchar
*
config_file
=
NULL
;
/* first get config file */
config_file
=
g_build_path
(
G_DIR_SEPARATOR_S
,
g_get_user_config_dir
(),
LIBIPHONE_CONF_DIR
,
LIBIPHONE_CONF_FILE
,
NULL
);
config_file
=
g_build_path
(
G_DIR_SEPARATOR_S
,
g_get_user_config_dir
(),
LIBIPHONE_CONF_DIR
,
LIBIPHONE_CONF_FILE
,
NULL
);
if
(
g_file_test
(
config_file
,
(
G_FILE_TEST_EXISTS
|
G_FILE_TEST_IS_REGULAR
)))
{
/*
now parse file to get the HostID
*/
/*
now parse file to get the HostID
*/
GKeyFile
*
key_file
=
g_key_file_new
();
if
(
g_key_file_load_from_file
(
key_file
,
config_file
,
G_KEY_FILE_KEEP_COMMENTS
,
NULL
)
)
{
gchar
*
loc_host_id
=
g_key_file_get_value
(
key_file
,
"Global"
,
"HostID"
,
NULL
);
gchar
*
loc_host_id
=
g_key_file_get_value
(
key_file
,
"Global"
,
"HostID"
,
NULL
);
if
(
loc_host_id
)
host_id
=
strdup
(
loc_host_id
);
g_free
(
loc_host_id
);
...
...
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