今天下完ubuntu7.10之后,因为学校需要dr.com(v3.39)在win下登陆上网,于是按照论坛里的帖子,下了drcom-1.3.7.tar.gz,编译的时候出些下面的代码,请高手们多多指教!
root@blackstar:/tmp/drcom-1.3.7# make
make -C drcomc
make[1]: Entering directory `/tmp/drcom-1.3.7/drcomc'
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o drcomc.o drcomc.c
gcc drcomc.o -o drcomc
make[1]: Leaving directory `/tmp/drcom-1.3.7/drcomc'
make -C drcomd
make[1]: Entering directory `/tmp/drcom-1.3.7/drcomd'
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o drcomd.o drcomd.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o daemon.o daemon.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o cleanup.o cleanup.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o dialog.o dialog.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o handle.o handle.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o init.o init.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o keepalive.o keepalive.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o login.o login.c
login.c: In function ‘drcom_login’:
login.c:50: warning: unused parameter ‘timeout’
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o logout.o logout.c
logout.c: In function ‘drcom_logout’:
logout.c:34: warning: unused parameter ‘timeout’
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o md5.o md5.c
md5.c:131:36: warning: use of C99 long long integer constant
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o misc.o misc.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o passwd.o passwd.c
passwd.c: In function ‘drcom_passwd’:
passwd.c:32: warning: unused parameter ‘timeout’
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o readconf.o readconf.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o watchport.o watchport.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o getaddr.o getaddr.c
gcc -Wall -W -Wstrict-prototypes -Wmissing-prototypes -pedantic -I/tmp/drcom-1.3.7/include -O2 -c -o log.o log.c
log.c: In function ‘dbg’:
log.c:34: warning: unused parameter ‘format’
gcc -lm -lpthread drcomd.o daemon.o cleanup.o dialog.o handle.o init.o keepalive.o login.o logout.o md5.o misc.o passwd.o readconf.o watchport.o getaddr.o log.o -o drcomd
make[1]: Leaving directory `/tmp/drcom-1.3.7/drcomd'
make -C kmod
make[1]: Entering directory `/tmp/drcom-1.3.7/kmod'
make -C /lib/modules/2.6.22-14-generic/build M=/tmp/drcom-1.3.7/kmod modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.22-14-generic'
CC [M] /tmp/drcom-1.3.7/kmod/init.o
CC [M] /tmp/drcom-1.3.7/kmod/proc.o
CC [M] /tmp/drcom-1.3.7/kmod/proto.o
/tmp/drcom-1.3.7/kmod/proto.c: In function ‘init_hijack’:
/tmp/drcom-1.3.7/kmod/proto.c:453: warning: assignment from incompatible pointer type
/tmp/drcom-1.3.7/kmod/proto.c:454: warning: assignment from incompatible pointer type
/tmp/drcom-1.3.7/kmod/proto.c: In function ‘cleanup_hijack’:
/tmp/drcom-1.3.7/kmod/proto.c:461: warning: comparison of distinct pointer types lacks a cast
/tmp/drcom-1.3.7/kmod/proto.c:462: warning: assignment from incompatible pointer type
LD [M] /tmp/drcom-1.3.7/kmod/drcom.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/drcom-1.3.7/kmod/drcom.mod.o
LD [M] /tmp/drcom-1.3.7/kmod/drcom.ko
make[2]: Leaving directory `/usr/src/linux-headers-2.6.22-14-generic'
make[1]: Leaving directory `/tmp/drcom-1.3.7/kmod'
我的内核信息:
root@blackstar:~# uname -r
2.6.22-14-generic
root@blackstar:~# ls /usr/src
linux-headers-2.6.22-14 linux-headers-2.6.22-14-generic
gcc的版本:
root@blackstar:~# cat /proc/version
Linux version 2.6.22-14-generic (buildd@palmer) (gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)) #1 SMP Sun Oct 14 23:05:12 GMT 2007
请各位高手们指点,被dr.com折磨很长时间了,痛苦啊......
[问题]ubuntu7.10下make的问题,求救!
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
- bslt
- 帖子: 29
- 注册时间: 2007-06-10 8:28
[问题]ubuntu7.10下make的问题,求救!
上次由 bslt 在 2007-10-20 16:43,总共编辑 2 次。
-
- 帖子: 279
- 注册时间: 2006-03-02 22:34
- 来自: 广西南宁
- bslt
- 帖子: 29
- 注册时间: 2007-06-10 8:28
这是drcom-1.3.7的login.c代码:
/*
libdrcom - Library for communicating with DrCOM 2133 Broadband Access Server
Copyright (C) 2005 William Poetra Yoga Hadisoeseno <williampoetra@yahoo.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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <string.h>
#include "md5.h"
#include "log.h"
#include "private.h"
void _build_login_packet(struct drcom_login_packet *, struct drcom_info *, struct drcom_host *, struct drcom_challenge *);
void _build_authentication(struct drcom_auth *, struct drcom_acknowledgement *);
void _build_keepalive(struct drcom_host_msg *, struct drcom_login_packet *, struct drcom_acknowledgement *);
/*
static void mylog_message(int priority, const char *format, va_list args)
{
vfprintf(stderr, format, args);
}
void myloginfo(const char *format, ...)
{
va_list args;
va_start(args, format);
mylog_message(LOG_INFO, format, args);
va_end(args);
}
*/
/* drcom_login
Logs in.
*/
int drcom_login(struct drcom_handle *h, int timeout)
{
struct drcom_socks *socks = (struct drcom_socks *) h->socks;
struct drcom_info *info = (struct drcom_info *) h->info;
struct drcom_host *host = (struct drcom_host *) h->host;
struct drcom_host_msg *response = (struct drcom_host_msg *) h->response;
struct drcom_host_msg *keepalive = (struct drcom_host_msg *) h->keepalive;
struct drcom_auth *auth = (struct drcom_auth *) h->auth;
struct drcom_challenge challenge;
struct drcom_login_packet login_packet;
struct drcom_acknowledgement acknowledgement;
int retry=0;
try_it_again_1:
retry++;
if(retry>3)
return -1;
if(_send_dialog_packet(socks, NULL, PKT_REQUEST)<0){
logerr("_send_dialog_packet(PKT_REQUEST) failed\n");
return -1;
}
if(_recv_dialog_packet(socks, &challenge, PKT_CHALLENGE)<0){
logerr("_recv_dialog_packet(PKT_CHALLENGE) failed\n");
goto try_it_again_1;
}
/* Now the _real_ ip address of the server is known */
info->servip = socks->servaddr_in.sin_addr.s_addr;
_build_login_packet(&login_packet, info, host, &challenge);
retry=0;
try_it_again_2:
retry++;
if(retry>3)
return -1;
if(_send_dialog_packet(socks, &login_packet, PKT_LOGIN)<0){
logerr("_send_dialog_packet(PKT_LOGIN) failed\n");
return -1;
}
if(_recv_dialog_packet(socks, &acknowledgement, PKT_ACK_SUCCESS)<0){
logerr("_recv_dialog_packet(PKT_ACK_SUCCESS) failed\n");
goto try_it_again_2;
}
if (acknowledgement.serv_header.pkt_type == PKT_ACK_SUCCESS)
{
_build_authentication(auth, &acknowledgement);
_build_keepalive(keepalive, &login_packet, &acknowledgement);
memcpy(response, keepalive, sizeof(*keepalive));
loginfo("You have used %u Minutes, and %uK bytes\n",
acknowledgement.time_usage, acknowledgement.vol_usage);
return 0;
}
else
return -1;
}
void _build_login_packet(struct drcom_login_packet *login_packet,
struct drcom_info *info, struct drcom_host *host,
struct drcom_challenge *challenge)
{
char s[25];
unsigned char t[22], d[16];
int i, passwd_len;
/* header */
login_packet->host_header.pkt_type = PKT_LOGIN;
login_packet->host_header.zero = 0;
login_packet->host_header.len = strlen(info->username) +
sizeof(struct drcom_host_header);
memset(t, 0, 22);
memcpy(t, &login_packet->host_header.pkt_type, 2);
memcpy(t + 2, &challenge->challenge, 4);
passwd_len = strlen(info->password);
strncpy((char *) (t + 6), info->password, 16);
MD5((unsigned char *) t, passwd_len + 6, d);
memcpy(login_packet->host_header.checksum, d, 16);
/* username */
memset(login_packet->username, 0, 36);
strncpy(login_packet->username, info->username, 36);
/* unknown, maybe just a signature? */
login_packet->unknown0 = 0x18;
/* mac */
login_packet->mac_code = 1;
memcpy(login_packet->mac_xor, info->mac, 6);
for (i = 0; i < 6; ++i)
login_packet->mac_xor ^= login_packet->host_header.checksum;
/* ok, first checksum */
/* l already calculated */
/* l = strlen(info->password); */
s[0] = 0x01;
memcpy(s + 1, info->password, passwd_len);
memcpy(s + 1 + passwd_len, &challenge->challenge, 4);
memset(s + 1 + passwd_len + 4, 0, 4);
MD5((unsigned char *) s, 1 + passwd_len + 4 + 4, d);
memcpy(login_packet->checksum1, d, 16);
/* nic */
login_packet->num_nic = 1;
memcpy(login_packet->nic, info->nic, 16);
/* second checksum */
login_packet->checksum2_half[0] = 0x14;
login_packet->checksum2_half[1] = 0x00;
login_packet->checksum2_half[2] = 0x07;
login_packet->checksum2_half[3] = 0x0b;
MD5((unsigned char *) login_packet, 0x65, d);
memcpy(login_packet->checksum2_half, d, 8);
/* we've got a dog */
login_packet->dog = 1;
/* host info */
memset(login_packet->zero1, 0, 4);
memcpy(&login_packet->host_info, host, sizeof(struct drcom_host));
memset(login_packet->zero2, 0, 96);
/* wtf? */
login_packet->unknown1 = 0x01;
login_packet->unknown2 = 0x00;
login_packet->unknown3[0] = 0x01;
login_packet->unknown3[1] = 0x08;
/* maybe we should use something random instead? */
/*
memset(login_packet->unknown4, 0, 8);
*/
login_packet->unknown4[0] = 0x00;
login_packet->unknown4[1] = 0xf0;
login_packet->unknown4[2] = 0x66;
login_packet->unknown4[3] = 0x33;
login_packet->unknown4[4] = 0x72;
login_packet->unknown4[5] = 0x5b;
login_packet->unknown4[6] = 0xc4;
login_packet->unknown4[7] = 0x01;
/*
memcpy(login_packet->unknown4, d + 8, 8);
*/
return;
}
void _build_authentication(struct drcom_auth *auth, struct drcom_acknowledgement *acknowledgement)
{
memcpy(auth, &acknowledgement->auth_info, sizeof(struct drcom_auth));
return;
}
void _build_keepalive(struct drcom_host_msg *keepalive, struct drcom_login_packet *login_packet, struct drcom_acknowledgement *acknowledgement)
{
keepalive->msgtype = 0xff;
memset(keepalive->msg, 0, 19);
memcpy(keepalive->msg, login_packet->host_header.checksum, 16);
memcpy(&keepalive->auth_info, &acknowledgement->auth_info, sizeof(struct drcom_auth));
return;
}
/*
libdrcom - Library for communicating with DrCOM 2133 Broadband Access Server
Copyright (C) 2005 William Poetra Yoga Hadisoeseno <williampoetra@yahoo.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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <string.h>
#include "md5.h"
#include "log.h"
#include "private.h"
void _build_login_packet(struct drcom_login_packet *, struct drcom_info *, struct drcom_host *, struct drcom_challenge *);
void _build_authentication(struct drcom_auth *, struct drcom_acknowledgement *);
void _build_keepalive(struct drcom_host_msg *, struct drcom_login_packet *, struct drcom_acknowledgement *);
/*
static void mylog_message(int priority, const char *format, va_list args)
{
vfprintf(stderr, format, args);
}
void myloginfo(const char *format, ...)
{
va_list args;
va_start(args, format);
mylog_message(LOG_INFO, format, args);
va_end(args);
}
*/
/* drcom_login
Logs in.
*/
int drcom_login(struct drcom_handle *h, int timeout)
{
struct drcom_socks *socks = (struct drcom_socks *) h->socks;
struct drcom_info *info = (struct drcom_info *) h->info;
struct drcom_host *host = (struct drcom_host *) h->host;
struct drcom_host_msg *response = (struct drcom_host_msg *) h->response;
struct drcom_host_msg *keepalive = (struct drcom_host_msg *) h->keepalive;
struct drcom_auth *auth = (struct drcom_auth *) h->auth;
struct drcom_challenge challenge;
struct drcom_login_packet login_packet;
struct drcom_acknowledgement acknowledgement;
int retry=0;
try_it_again_1:
retry++;
if(retry>3)
return -1;
if(_send_dialog_packet(socks, NULL, PKT_REQUEST)<0){
logerr("_send_dialog_packet(PKT_REQUEST) failed\n");
return -1;
}
if(_recv_dialog_packet(socks, &challenge, PKT_CHALLENGE)<0){
logerr("_recv_dialog_packet(PKT_CHALLENGE) failed\n");
goto try_it_again_1;
}
/* Now the _real_ ip address of the server is known */
info->servip = socks->servaddr_in.sin_addr.s_addr;
_build_login_packet(&login_packet, info, host, &challenge);
retry=0;
try_it_again_2:
retry++;
if(retry>3)
return -1;
if(_send_dialog_packet(socks, &login_packet, PKT_LOGIN)<0){
logerr("_send_dialog_packet(PKT_LOGIN) failed\n");
return -1;
}
if(_recv_dialog_packet(socks, &acknowledgement, PKT_ACK_SUCCESS)<0){
logerr("_recv_dialog_packet(PKT_ACK_SUCCESS) failed\n");
goto try_it_again_2;
}
if (acknowledgement.serv_header.pkt_type == PKT_ACK_SUCCESS)
{
_build_authentication(auth, &acknowledgement);
_build_keepalive(keepalive, &login_packet, &acknowledgement);
memcpy(response, keepalive, sizeof(*keepalive));
loginfo("You have used %u Minutes, and %uK bytes\n",
acknowledgement.time_usage, acknowledgement.vol_usage);
return 0;
}
else
return -1;
}
void _build_login_packet(struct drcom_login_packet *login_packet,
struct drcom_info *info, struct drcom_host *host,
struct drcom_challenge *challenge)
{
char s[25];
unsigned char t[22], d[16];
int i, passwd_len;
/* header */
login_packet->host_header.pkt_type = PKT_LOGIN;
login_packet->host_header.zero = 0;
login_packet->host_header.len = strlen(info->username) +
sizeof(struct drcom_host_header);
memset(t, 0, 22);
memcpy(t, &login_packet->host_header.pkt_type, 2);
memcpy(t + 2, &challenge->challenge, 4);
passwd_len = strlen(info->password);
strncpy((char *) (t + 6), info->password, 16);
MD5((unsigned char *) t, passwd_len + 6, d);
memcpy(login_packet->host_header.checksum, d, 16);
/* username */
memset(login_packet->username, 0, 36);
strncpy(login_packet->username, info->username, 36);
/* unknown, maybe just a signature? */
login_packet->unknown0 = 0x18;
/* mac */
login_packet->mac_code = 1;
memcpy(login_packet->mac_xor, info->mac, 6);
for (i = 0; i < 6; ++i)
login_packet->mac_xor ^= login_packet->host_header.checksum;
/* ok, first checksum */
/* l already calculated */
/* l = strlen(info->password); */
s[0] = 0x01;
memcpy(s + 1, info->password, passwd_len);
memcpy(s + 1 + passwd_len, &challenge->challenge, 4);
memset(s + 1 + passwd_len + 4, 0, 4);
MD5((unsigned char *) s, 1 + passwd_len + 4 + 4, d);
memcpy(login_packet->checksum1, d, 16);
/* nic */
login_packet->num_nic = 1;
memcpy(login_packet->nic, info->nic, 16);
/* second checksum */
login_packet->checksum2_half[0] = 0x14;
login_packet->checksum2_half[1] = 0x00;
login_packet->checksum2_half[2] = 0x07;
login_packet->checksum2_half[3] = 0x0b;
MD5((unsigned char *) login_packet, 0x65, d);
memcpy(login_packet->checksum2_half, d, 8);
/* we've got a dog */
login_packet->dog = 1;
/* host info */
memset(login_packet->zero1, 0, 4);
memcpy(&login_packet->host_info, host, sizeof(struct drcom_host));
memset(login_packet->zero2, 0, 96);
/* wtf? */
login_packet->unknown1 = 0x01;
login_packet->unknown2 = 0x00;
login_packet->unknown3[0] = 0x01;
login_packet->unknown3[1] = 0x08;
/* maybe we should use something random instead? */
/*
memset(login_packet->unknown4, 0, 8);
*/
login_packet->unknown4[0] = 0x00;
login_packet->unknown4[1] = 0xf0;
login_packet->unknown4[2] = 0x66;
login_packet->unknown4[3] = 0x33;
login_packet->unknown4[4] = 0x72;
login_packet->unknown4[5] = 0x5b;
login_packet->unknown4[6] = 0xc4;
login_packet->unknown4[7] = 0x01;
/*
memcpy(login_packet->unknown4, d + 8, 8);
*/
return;
}
void _build_authentication(struct drcom_auth *auth, struct drcom_acknowledgement *acknowledgement)
{
memcpy(auth, &acknowledgement->auth_info, sizeof(struct drcom_auth));
return;
}
void _build_keepalive(struct drcom_host_msg *keepalive, struct drcom_login_packet *login_packet, struct drcom_acknowledgement *acknowledgement)
{
keepalive->msgtype = 0xff;
memset(keepalive->msg, 0, 19);
memcpy(keepalive->msg, login_packet->host_header.checksum, 16);
memcpy(&keepalive->auth_info, &acknowledgement->auth_info, sizeof(struct drcom_auth));
return;
}