Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
09dcd5bc
Commit
09dcd5bc
authored
16 years ago
by
Emmanuel Milou
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in reqaccount.c - Cyrille Béraud
parent
535ad204
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sflphone-gtk/src/reqaccount.c
+12
-16
12 additions, 16 deletions
sflphone-gtk/src/reqaccount.c
with
12 additions
and
16 deletions
sflphone-gtk/src/reqaccount.c
+
12
−
16
View file @
09dcd5bc
/*
* Copyright (C) 2009
Jean Schurger <jean@schurger.org>
* an
d
Savoir
-F
aire
L
inux
inc.
* Copyright (C) 2009
Savoir-Faire Linux inc.
*
Author Je
an S
churger <jean.schurger@s
avoir
f
aire
l
inux
.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -43,25 +43,19 @@ int req(char *host, int port, char *req, char *ret) {
int
s
;
struct
sockaddr_in
servSockAddr
;
struct
hostent
*
servHostEnt
;
long
hostAddr
;
long
status
;
int
length
,
i
;
long
int
length
=
0
;
long
int
status
=
0
;
int
i
=
0
;
FILE
*
f
;
char
buf
[
1024
];
bzero
(
&
servSockAddr
,
sizeof
(
servSockAddr
));
hostAddr
=
inet_addr
(
host
);
if
((
long
)
hostAddr
!=
(
long
)
-
1
)
bcopy
(
&
hostAddr
,
&
servSockAddr
.
sin_addr
,
sizeof
(
hostAddr
));
else
{
servHostEnt
=
gethostbyname
(
host
);
if
(
servHostEnt
==
NULL
)
{
servHostEnt
=
gethostbyname
(
host
);
if
(
servHostEnt
==
NULL
)
{
strcpy
(
ret
,
"gethostbyname"
);
return
-
1
;
}
bcopy
(
servHostEnt
->
h_addr
,
&
servSockAddr
.
sin_addr
,
servHostEnt
->
h_length
);
}
bcopy
((
char
*
)
servHostEnt
->
h_addr
,
(
char
*
)
&
servSockAddr
.
sin_addr
,
servHostEnt
->
h_length
);
servSockAddr
.
sin_port
=
htons
(
port
);
servSockAddr
.
sin_family
=
AF_INET
;
...
...
@@ -70,8 +64,8 @@ int req(char *host, int port, char *req, char *ret) {
return
-
1
;
}
if
(
connect
(
s
,
(
const
struct
sockaddr
*
)
&
servSockAddr
,
(
socklen_t
)
sizeof
(
servSockAddr
))
<
0
)
{
if
(
connect
(
s
,
(
const
struct
sockaddr
*
)
&
servSockAddr
,
(
socklen_t
)
sizeof
(
servSockAddr
))
<
0
)
{
perror
(
"foo"
);
strcpy
(
ret
,
"connect"
);
return
-
1
;
}
...
...
@@ -109,6 +103,7 @@ rest_account get_rest_account(char *host) {
char
ret
[
4096
];
rest_account
ra
;
bzero
(
ret
,
sizeof
(
ret
));
printf
(
"HOST: %s
\n
"
,
host
);
if
(
req
(
host
,
80
,
"GET /rest/accountcreator"
,
ret
)
!=
-
1
)
{
strcpy
(
ra
.
user
,
strtok
(
ret
,
"
\n
"
));
strcpy
(
ra
.
passwd
,
strtok
(
NULL
,
"
\n
"
));
\
...
...
@@ -117,6 +112,7 @@ rest_account get_rest_account(char *host) {
ra
.
success
=
0
;
strcpy
(
ra
.
reason
,
ret
);
}
puts
(
ret
);
return
ra
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment