commit smbtad for openSUSE:Factory
Hello community, here is the log from the commit of package smbtad for openSUSE:Factory checked in at Thu Nov 18 17:01:15 CET 2010. -------- --- smbtad/smbtad.changes 2010-11-11 14:04:00.000000000 +0100 +++ smbtad/smbtad.changes 2010-11-15 23:59:21.000000000 +0100 @@ -1,0 +2,10 @@ +Mon Nov 15 22:52:38 UTC 2010 - hhetter@novell.com + +- update to version 1.2: + - bnc#651890, smbtad doesn't speak over a unix domain socket + with the module. + - bnc#652755, the query port is not correctly read in by file + configuration in smbtad. +- the specfile adds an example configuration file for smbtad. + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- smbtad-1.1.tar.bz2 New: ---- smbtad-1.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ smbtad.spec ++++++ --- /var/tmp/diff_new_pack.MOzzWY/_old 2010-11-18 17:00:31.000000000 +0100 +++ /var/tmp/diff_new_pack.MOzzWY/_new 2010-11-18 17:00:31.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package smbtad (Version 1.1) +# spec file for package smbtad (Version 1.2) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -25,7 +25,7 @@ BuildRecommends: libiniparser-devel License: GPLv3+ Group: Productivity/Networking/Samba -Version: 1.1 +Version: 1.2 Release: 1 Summary: A collector of smbd share usage data Url: http://github.com/hhetter/smbtad @@ -81,5 +81,6 @@ %{_bindir}/smbtad %{_sbindir}/rcsmbtad %attr(0754,root,root) %config %{INITDIR}/smbtad +%doc dist/smbtad.conf_example %changelog ++++++ smbtad-1.1.tar.bz2 -> smbtad-1.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smbtad-1.1/dist/smbtad.spec new/smbtad-1.2/dist/smbtad.spec --- old/smbtad-1.1/dist/smbtad.spec 2010-11-06 21:28:20.000000000 +0100 +++ new/smbtad-1.2/dist/smbtad.spec 2010-11-15 23:31:52.000000000 +0100 @@ -25,7 +25,7 @@ BuildRecommends: libiniparser-devel License: GPLv3+ Group: Productivity/Networking/Samba -Version: 1.0 +Version: 1.2 Release: 1 Summary: A collector of smbd share usage data Url: http://github.com/hhetter/smbtad @@ -70,7 +70,8 @@ make DESTDIR=%{buildroot} install %endif popd build - +mkdir -p %{buildroot}/usr/sbin +ln -s /etc/init.d/smbtad %{buildroot}/usr/sbin/rcsmbtad %clean %__rm -rf %{buildroot} @@ -80,4 +81,5 @@ %{_bindir}/smbtad %{_sbindir}/rcsmbtad %attr(0754,root,root) %config %{INITDIR}/smbtad +%doc dist/smbtad.conf_example %changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smbtad-1.1/include/configuration.h new/smbtad-1.2/include/configuration.h --- old/smbtad-1.1/include/configuration.h 2010-11-06 21:28:20.000000000 +0100 +++ new/smbtad-1.2/include/configuration.h 2010-11-15 23:31:52.000000000 +0100 @@ -42,7 +42,9 @@ char *config_file; /* daemon mode */ int daemon; - + /* 1 if a unix domain socket is used for the connection to the */ + /* module. */ + int unix_socket; /* run time configuration */ /* integers used to separate the time for the maintenance run */ int mdays,mminutes,mseconds,mhours; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smbtad-1.1/include/version.h new/smbtad-1.2/include/version.h --- old/smbtad-1.1/include/version.h 2010-11-06 21:28:20.000000000 +0100 +++ new/smbtad-1.2/include/version.h 2010-11-15 23:31:52.000000000 +0100 @@ -1,2 +1,2 @@ #define SMBTA_LICENSE "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>" -#define STAD2_VERSION "1.1" +#define STAD2_VERSION "1.2" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smbtad-1.1/src/configuration.c new/smbtad-1.2/src/configuration.c --- old/smbtad-1.1/src/configuration.c 2010-11-06 21:28:20.000000000 +0100 +++ new/smbtad-1.2/src/configuration.c 2010-11-15 23:31:52.000000000 +0100 @@ -58,7 +58,7 @@ c->daemon = 1; c->config_file = NULL; c->dbg = 0; // debug level - + c->unix_socket = 0; c->dbhandle = NULL; c->keyfile =NULL; c->query_port = 3941; @@ -97,12 +97,14 @@ if ( Mydict == NULL ) return -1; + cc = iniparser_getstring (Mydict, "network:unix_domain_socket",NULL); + if (cc!= NULL) c->unix_socket = 1; cc = iniparser_getstring( Mydict, "network:port_number",NULL); if (cc != NULL) c->port = atoi(cc); cc = iniparser_getstring( Mydict, "network:query_port",NULL); - if (cc != NULL) c->port = atoi(cc); + if (cc != NULL) c->query_port = atoi(cc); cc = iniparser_getstring(Mydict,"database:sqlite_filename",NULL); if ( cc != NULL ) { @@ -176,15 +178,19 @@ { "database",1,NULL,'b'}, { "maintenance-timer",1,NULL,'t'}, { "maintenance-timer-config",1,NULL,'m'}, + { "unix-domain-socket",0,NULL,'u'}, { 0,0,0,0 } }; i = getopt_long( argc, argv, - "d:i:oc:k:q:b:t:m:", long_options, &option_index ); + "d:i:oc:k:q:b:t:m:u", long_options, &option_index ); if ( i == -1 ) break; switch (i) { + case 'u': + c->unix_socket = 1; + break; case 'i': c->port = atoi( optarg ); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smbtad-1.1/src/help.c new/smbtad-1.2/src/help.c --- old/smbtad-1.1/src/help.c 2010-11-06 21:28:20.000000000 +0100 +++ new/smbtad-1.2/src/help.c 2010-11-15 23:31:52.000000000 +0100 @@ -30,6 +30,10 @@ printf("\n"); printf("-i --inet-port Specifiy the port to be used. \n"); printf(" Default: 3490. \n"); + printf("-u --unix-domain-socket If this parameter is specified, \n"); + printf(" a unix domain socket at \n"); + printf(" /var/tmp/stadsocket will be \n"); + printf(" used. \n"); printf("-d --debug-level Specify the debug level (0-10). \n"); printf(" Default: 0. \n"); printf("-o --interactive Don't run as daemon. \n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smbtad-1.1/src/network.c new/smbtad-1.2/src/network.c --- old/smbtad-1.1/src/network.c 2010-11-06 21:28:20.000000000 +0100 +++ new/smbtad-1.2/src/network.c 2010-11-15 23:31:52.000000000 +0100 @@ -68,17 +68,30 @@ * Accept an incoming connection * and add it to the list of connections. */ -int network_accept_connection( config_t *c, struct sockaddr_in *remote, int type) +int network_accept_connection( config_t *c, struct sockaddr_in *remote_inet, struct sockaddr_un *remote_unix, int type) { - socklen_t t=sizeof(*remote); + socklen_t t; + if ( c->unix_socket ==1 ) t=sizeof(*remote_unix); + else t=sizeof(*remote_inet); int sr; int sock = 0; if (type == SOCK_TYPE_DATA) sock = c->vfs_socket; if (type == SOCK_TYPE_DB_QUERY) sock = c->query_socket; - if ( (sr = accept( sock, - (struct sockaddr *) remote, &t)) == -1) { - syslog(LOG_DEBUG,"ERROR: accept failed."); - return -1; + /* accepting on a unix socket can only happen with */ + /* SOCK_TYPE_DATA, since the client programs only */ + /* support an internet socket */ + if (c->unix_socket == 1 && type == SOCK_TYPE_DATA) { + if ( (sr = accept( sock, + (struct sockaddr *) remote_unix, &t)) == -1) { + syslog(LOG_DEBUG,"ERROR: accept (unix socket) failed."); + return -1; + } + } else { + if ( (sr = accept( sock, + (struct sockaddr *) remote_inet, &t)) == -1) { + syslog(LOG_DEBUG,"ERROR: accept (inet) failed."); + return -1; + } } connection_list_add(sr, type); return sr; @@ -332,6 +345,30 @@ } /** + * create a unix domain socket + * + */ +int network_create_unix_socket() +{ + /* Create a streaming UNIX Domain Socket */ + int s,len; + struct sockaddr_un local; + if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1){ + syslog(LOG_DAEMON, "ERROR: unix socket creation failed."); + return 1; + } + + local.sun_family= AF_UNIX; + strcpy(local.sun_path,"/var/tmp/stadsocket"); + unlink(local.sun_path); + len=strlen(local.sun_path) + sizeof(local.sun_family); + bind(s,(struct sockaddr *) &local, len); + listen(s,50); + return s; +} + + +/** * Run select() on the server handle, and call * the required functions to handle data. * config_t *c A configuration structure. @@ -340,16 +377,18 @@ { int i; int z=0; - int t; - struct sockaddr_in remote; - t=sizeof(remote); + struct sockaddr_un remote_unix; + struct sockaddr_in remote_inet; fd_set read_fd_set, active_read_fd_set; fd_set write_fd_set, active_write_fd_set; FD_ZERO(&active_read_fd_set ); FD_ZERO(&active_write_fd_set ); + if (c->unix_socket == 0) + c->vfs_socket = network_create_socket( c->port ); + else + c->vfs_socket = network_create_unix_socket(); - c->vfs_socket = network_create_socket( c->port ); c->query_socket = network_create_socket( c->query_port ); connection_list_add( c->vfs_socket, SOCK_TYPE_DATA ); @@ -375,12 +414,14 @@ if ( i == c->vfs_socket) sr = network_accept_connection( c, - &remote, + &remote_inet, + &remote_unix, SOCK_TYPE_DATA); else if ( i == c->query_socket) sr = network_accept_connection( c, - &remote, + &remote_inet, + &remote_unix, SOCK_TYPE_DB_QUERY); else { network_handle_data(i,c); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de