add missing headers and fix main() prototype to make this build with clang

This commit is contained in:
naddy 2017-05-06 17:23:10 +00:00
parent c7bdddd873
commit 2b2de20cdd
7 changed files with 124 additions and 59 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.9 2015/05/17 11:42:18 sthen Exp $
# $OpenBSD: Makefile,v 1.10 2017/05/06 17:23:10 naddy Exp $
COMMENT= distributed passwd file cracker
VERSION= 2.0b
REVISION= 0
REVISION= 1
DISTNAME= slurpie
PKGNAME= ${DISTNAME}-${VERSION}
CATEGORIES= security

View File

@ -1,16 +1,8 @@
$OpenBSD: patch-src_master_c,v 1.2 2010/05/22 16:02:23 espie Exp $
--- src/master.c.orig Sat Jan 30 22:08:08 1999
+++ src/master.c Sat May 22 18:00:53 2010
@@ -7,6 +7,8 @@ master.c: network core for controlling nodes (node.c).
/////////////////////////////
#include "master.h"
+#include <stdlib.h>
+#include <string.h>
/////////////////////////////
@@ -56,7 +58,7 @@ int init( void )
$OpenBSD: patch-src_master_c,v 1.3 2017/05/06 17:23:10 naddy Exp $
Index: src/master.c
--- src/master.c.orig
+++ src/master.c
@@ -56,7 +56,7 @@ int init( void )
strcpy( global.node[id]->ipstr, str );
global.node[id]->addr.sin_addr.s_addr = inet_addr(str);
fscanf(fp,"%s\n", str );
@ -19,7 +11,22 @@ $OpenBSD: patch-src_master_c,v 1.2 2010/05/22 16:02:23 espie Exp $
global.node[id]->addr.sin_family = AF_INET;
global.node[id]->socket = socket( AF_INET, SOCK_STREAM, 0 );
}
@@ -147,7 +149,7 @@ int main( int argc, u_char **argv )
@@ -132,12 +132,12 @@ char *get_time_str( u_int seconds )
return timestr;
}
-int main( int argc, u_char **argv )
+int main( int argc, char **argv )
{
static unsigned id, init_time;
global.num_nodes = 0;
- if(!commline_handler(argc,argv))
+ if(!commline_handler(argc,(u_char **)argv))
clean_up(1);
if(!init())
error("error: could not load %s\n", NODES_FILE );
@@ -147,7 +147,7 @@ int main( int argc, u_char **argv )
{
print_handler("connecting to: %s %d: ",
global.node[id]->ipstr,
@ -28,7 +35,14 @@ $OpenBSD: patch-src_master_c,v 1.2 2010/05/22 16:02:23 espie Exp $
if(!connect_node(id))
print_handler("connect failed.\n");
else
@@ -187,7 +189,7 @@ int main( int argc, u_char **argv )
@@ -181,13 +181,13 @@ int main( int argc, u_char **argv )
{
static u_char *pstr;
static u_int len;
- if( pstr = message_handler(netbuf,&len) )
+ if( (pstr = message_handler(netbuf,&len)) )
write( global.node[id++]->socket, pstr, len );
else
{
print("closing connection: %s %d.\n",
global.node[id]->ipstr,

View File

@ -1,7 +1,8 @@
$OpenBSD: patch-src_mn_h,v 1.1.1.1 2001/01/03 22:34:09 danh Exp $
--- src/mn.h.orig Sat Jan 30 16:09:01 1999
+++ src/mn.h Wed Jan 3 15:17:44 2001
@@ -2,11 +2,12 @@
$OpenBSD: patch-src_mn_h,v 1.2 2017/05/06 17:23:10 naddy Exp $
Index: src/mn.h
--- src/mn.h.orig
+++ src/mn.h
@@ -2,11 +2,16 @@
#define _MN_H_
/////////////////////////////////
@ -11,9 +12,13 @@ $OpenBSD: patch-src_mn_h,v 1.1.1.1 2001/01/03 22:34:09 danh Exp $
#include <sys/types.h>
#include <sys/time.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
/////////////////////////////////

View File

@ -1,16 +1,8 @@
$OpenBSD: patch-src_node_c,v 1.2 2010/05/22 16:02:23 espie Exp $
--- src/node.c.orig Sat Jan 30 22:10:17 1999
+++ src/node.c Sat May 22 18:01:33 2010
@@ -8,6 +8,8 @@ node.c: network core for serving the master (master.c)
/////////////////////////////
#include "node.h"
+#include <string.h>
+#include <stdlib.h>
/////////////////////////////
@@ -49,7 +51,7 @@ int init( void )
$OpenBSD: patch-src_node_c,v 1.3 2017/05/06 17:23:10 naddy Exp $
Index: src/node.c
--- src/node.c.orig
+++ src/node.c
@@ -49,7 +49,7 @@ int init( void )
global.self.addr.sin_family = AF_INET;
global.self.addr.sin_addr.s_addr = INADDR_ANY;
if( !global.self.addr.sin_port )
@ -19,8 +11,28 @@ $OpenBSD: patch-src_node_c,v 1.2 2010/05/22 16:02:23 espie Exp $
global.self.sa_len = sizeof(global.self.addr);
if( bind( global.self.socket,
@@ -111,12 +113,13 @@ int main( int argc, u_char **argv )
if(!commline_handler(argc,argv))
@@ -67,7 +67,7 @@ void sleep_mode( void )
(struct sockaddr *)&global.master.addr,
&global.master.sa_len );
FD_SET(global.master.socket, &global.net_fds);
- strcpy(global.master.ipstr,(u_char *)inet_ntoa(&global.master.addr.sin_addr));
+ strcpy(global.master.ipstr,(u_char *)inet_ntoa(global.master.addr.sin_addr));
// indicate a first time connect to master
write( global.master.socket, FIRST_SEND, strlen(FIRST_SEND) );
}
@@ -102,21 +102,22 @@ void clean_up( int exit_status )
/////////////////////////////
-int main( int argc, u_char **argv )
+int main( int argc, char **argv )
{
u_int exit_state = 0;
global.self.addr.sin_port = 0;
// check for specific port request at command line
- if(!commline_handler(argc,argv))
+ if(!commline_handler(argc,(u_char **)argv))
clean_up(1);
if(!init())
- error("could not initialize on port: %d\n", global.self.addr.sin_port );
@ -35,3 +47,12 @@ $OpenBSD: patch-src_node_c,v 1.2 2010/05/22 16:02:23 espie Exp $
sleep_mode();
// awake
print_handler("master connected at %s.\n",
@@ -139,7 +140,7 @@ int main( int argc, u_char **argv )
static u_int len;
read(global.master.socket, netbuf, MAX_PACKET_SIZE);
- if( pstr = message_handler(netbuf,&len) )
+ if( (pstr = message_handler(netbuf,&len)) )
{
write( global.master.socket, pstr, len );
print(".\n");

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-src_shared_c,v 1.1 2017/05/06 17:23:10 naddy Exp $
Index: src/shared.c
--- src/shared.c.orig
+++ src/shared.c
@@ -13,6 +13,6 @@ shared.c: shared stuff among slurpie.c and slurp.c.
u_int strcpy_len( u_char *t, u_char *s )
{
u_char *low = s;
- while( *(t++) = *(s++) );
+ while( (*(t++) = *(s++)) );
return (s-low);
}

View File

@ -1,15 +1,17 @@
$OpenBSD: patch-src_slurp_c,v 1.2 2010/05/22 16:02:23 espie Exp $
--- src/slurp.c.orig Sat Jan 30 23:11:50 1999
+++ src/slurp.c Sat May 22 18:01:19 2010
@@ -13,6 +13,7 @@ dictionary comparison cracking.
#include <unistd.h>
#define _XOPEN_SOURCE
#endif
+#include <string.h>
$OpenBSD: patch-src_slurp_c,v 1.3 2017/05/06 17:23:10 naddy Exp $
Index: src/slurp.c
--- src/slurp.c.orig
+++ src/slurp.c
@@ -149,7 +149,7 @@ char *do_gdict( u_char *master_msg, u_char *sendbuf, u
salt[2] = '\0';
/////////////////////////////
@@ -239,7 +240,7 @@ int cl_proc( int argc, u_char **argv )
// run generated password search
- for( i=0; i<pwdlen; testpwd[i]=wl.cset[state[i++]] );
+ for( i=0; i<pwdlen; testpwd[i]=wl.cset[state[i]], i++ );
if(pwdlen>cfg.gtask_level)
pwdlen=cfg.gtask_level;
for( i=0; i<pwdlen; )
@@ -239,7 +239,7 @@ int cl_proc( int argc, u_char **argv )
if(argc>1)
{
@ -18,3 +20,11 @@ $OpenBSD: patch-src_slurp_c,v 1.2 2010/05/22 16:02:23 espie Exp $
goto jCOMM_HELP;
for( i=1; i<argc; i++ )
@@ -287,6 +287,6 @@ void print( const u_char *str, ... )
vsprintf(tbuf,str,parg);
va_end(parg);
if( cfg.cl & CL_VERBOSE )
- printf( tbuf );
+ printf( "%s", tbuf );
}

View File

@ -1,15 +1,8 @@
$OpenBSD: patch-src_slurpie_c,v 1.1 2010/05/22 16:02:23 espie Exp $
--- src/slurpie.c.orig Sat Jan 30 23:03:45 1999
+++ src/slurpie.c Sat May 22 18:00:32 2010
@@ -8,6 +8,7 @@ slurpie.c: distributes tasks among slurps (slurp.c).
/////////////////////////////
#include "master.h"
#include "shared.h"
+#include <string.h>
/////////////////////////////
static const u_char *CL_HELP_MENU =
@@ -129,7 +130,8 @@ u_char *send_init( u_char *sendbuf, u_int *send_len )
$OpenBSD: patch-src_slurpie_c,v 1.2 2017/05/06 17:23:10 naddy Exp $
Index: src/slurpie.c
--- src/slurpie.c.orig
+++ src/slurpie.c
@@ -129,7 +129,8 @@ u_char *send_init( u_char *sendbuf, u_int *send_len )
*(pstr++) = (u_char)cfg.cl;
if( cfg.cl & CL_PDICT )
{
@ -19,3 +12,12 @@ $OpenBSD: patch-src_slurpie_c,v 1.1 2010/05/22 16:02:23 espie Exp $
pstr += strcpy_len( pstr, cfg.dictfile_name );
}
if( cfg.cl & CL_GDICT )
@@ -378,7 +379,7 @@ void print( const u_char *str, ... )
vsprintf(tbuf,str,parg);
va_end(parg);
if( cfg.cl & CL_VERBOSE )
- printf( tbuf );
+ printf( "%s", tbuf );
if( cfg.logfile && !(cfg.cl & CL_NO_LOG) )
fputs( tbuf, cfg.logfile );
}