- Merge in gkrellm-2.3.2 release changes

This commit is contained in:
Stefan Gehn 2008-10-04 08:55:47 +00:00
parent 54aa6d29fb
commit 804e456c03
84 changed files with 7063 additions and 7864 deletions

View File

@ -1,14 +1,8 @@
The code in the GKrellM distribution is Copyright (C) 1999-2007 by Bill Wilson
except for:
md5global.h, base64.c which are Copyright 1997 by Eric S. Raymond and
are under the GPL.
base64.c which is Copyright 1997 by Eric S. Raymond and is under the GPL.
and
md5.h, md5c.c which are public domain.
and
smb.h, smbbyteorder.h, smbdes.c, smbdes.h, smbencrypt.c, smbencrypt.h,
smbmd4.c, smbmd4.h, smbutil.c and ntlm.h which are GPL files from
fetchmail-6.2.5 and are Copyright Andrew Tridgell as noted in the
fetchmail COPYING file.
and
some system dependent files which port GKrellM to architectures other
than Linux are Copyright their authors as indicated in the respective files.

View File

@ -1,9 +1,28 @@
GKrellM Changelog
-----------------
2.3.2 - Not released
2.3.2 - Fri Oct 3, 2008
------------------------
* Add OpenSSL license exception (TODO).
* Patch from Stefan Gehn:
- Add error logging routines so errors and debugging can be routed to
a file or stdout, and gkrellmd can log to the system syslog file.
Begin replacing debug printf() with g_message(), g_warning(), etc
functions to support the logging functions.
- Port gtk_combo functions to gtk_combo_box
- Add client mode server connection error dialog pupups.
- Use GTK 2.12 gtk_widget_xxx_tooltip over gtk_tooltip in mail.c
- win32 changes:
Use unicode function calls.
Use getaddrinfo() on win32.
Support CoreTemp application for getting cpu temperatures.
Redo sensor-handling to support multipe sensor backends.
Make Proc monitor work and properly count # of logged in users.
Mem monitor displays cache bytes.
System name shows some new windows versions.
Remove trayicon
- Other various cleanups and changes in his quite large patch.
* Add OpenSSL license exception.
Make OpenSSL the default to avoid gnutls symbol conflict crash.
* Link to libntlm and remove smb* files from gkrellm source distribution.
* Patch from Takao Fujiwara: Pass clock/calendar strings to strftime in
current locale. Bump default width up to 100.
* Patch from Leo Schwab: add linux sysfs battery interface. Use

View File

@ -63,6 +63,12 @@ hostname
.B \-\-port
server_port
]
[
.B \-l
|
.B \-\-logfile
path
]
.SH "DESCRIPTION"
.PP
@ -329,6 +335,9 @@ for the
.B gkrellmd
server connection.
.TP
.B \-l, \-\-logfile path
Enable sending error and debugging messages to a log file.
.TP
.B \-nc
No config mode. The config menu is blocked so no config changes
can be made. Useful in certain environments, or maybe for running

View File

@ -64,6 +64,13 @@ name
[
.B \-\-plog
]
|
.B \-\-logfile
path
]
|
.B \-\-syslog
]
[
.B \-U
|
@ -221,6 +228,12 @@ Output a log of the plugin install process. When requesting a log, the
.I --detach
option will have no effect.
Requires at least gkrellmd version 2.2.0.
.TP
.B \-l, \-\-logfile path
Enable sending error and debugging messages to a log file.
.TP
.B \-\-syslog
Enable sending logging messages to the syslog file.
.TP
.B \-c, \-\-clear-hosts

769
po/bg.po

File diff suppressed because it is too large Load Diff

769
po/cs.po

File diff suppressed because it is too large Load Diff

769
po/da.po

File diff suppressed because it is too large Load Diff

772
po/de.po

File diff suppressed because it is too large Load Diff

795
po/es.po

File diff suppressed because it is too large Load Diff

771
po/fr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

769
po/it.po

File diff suppressed because it is too large Load Diff

771
po/ja.po

File diff suppressed because it is too large Load Diff

769
po/nl.po

File diff suppressed because it is too large Load Diff

871
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

769
po/ru.po

File diff suppressed because it is too large Load Diff

785
po/sl.po

File diff suppressed because it is too large Load Diff

788
po/sv.po

File diff suppressed because it is too large Load Diff

View File

@ -116,6 +116,7 @@ struct GkrellmdConfig
inet_interval;
gboolean without_libsensors;
gboolean use_acpi_battery;
gboolean list_plugins,
log_plugins;

View File

@ -43,6 +43,9 @@ port 19150
#
#detach
# Enable writing logging message to the system syslog file
#syslog
# Time interval between checks for various monitors. If nfs-interval
# is <= 0 then gkrellmd will not read data for nfs file system types.
#

View File

@ -810,6 +810,8 @@ usage(void)
g_print(_(" -pe, --plugin-enable name Enable an installed plugin\n"));
g_print(_(" --plist List plugins and exit\n"));
g_print(_(" --plog Print plugin install log\n"));
g_print( " --logfile path Enable logging to a file\n");
g_print( " --syslog Enable logging to syslog\n");
g_print(_(" -V, --verbose increases the verbosity of gkrellmd\n"));
g_print(_(" -d, --debug-level n Turn debugging on for selective code sections.\n"));
@ -834,6 +836,8 @@ usage(void)
g_print(_(" -pe, --plugin-enable name Enable an installed plugin\n"));
g_print(_(" --plist List plugins and exit\n"));
g_print(_(" --plog Print plugin install log\n"));
g_print( " --logfile path Enable logging to a file\n");
g_print( " --syslog Enable logging to the system syslog file\n");
g_print(_(" --pidfile path Create a PID file\n"));
g_print(_(" -V, --verbose increases the verbosity of gkrellmd\n"));
g_print(_(" -h, --help display this help and exit\n"));
@ -1069,6 +1073,7 @@ detach_from_terminal(void)
#if !defined(MSG_NOSIGNAL)
signal(SIGPIPE, SIG_IGN);
#endif /* MSG_NOSIGNAL */
return TRUE;
}
#endif /* !defined(WIN32) */

View File

@ -1,73 +1,85 @@
/* GKrellM
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
|
|
| GKrellM 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 3 of the License, or
| (at your option) any later version.
|
| GKrellM 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, see http://www.gnu.org/licenses/
*/
#ifndef GK_LOG_P_H
#define GK_LOG_P_H
#include <glib.h>
typedef void (*GkrellmLogFunc) (GLogLevelFlags log_level, const gchar *message);
typedef gboolean (*GkrellmLogInitFunc) (void);
typedef gboolean (*GkrellmLogCleanupFunc) (void);
/**
* Installs a log handler and adds default logging behaviour.
*
* All GLib log functions and macros (i..e g_log(), g_debug(), g_warning() etc)
* are handled by our log handler from now on
**/
void gkrellm_log_init(void);
/**
* Removes our log handler reverting to default GLib log behaviour.
**/
void gkrellm_log_cleanup(void);
/**
* Registers another log function.
*
* Calls function @p init if it's not NULL and registers function @p log if
* the (optional) call to @p init was successful.
*
* @note This is mainly used by gkrellmd to register an additional
* syslog handler.
**/
gboolean gkrellm_log_register(
GkrellmLogFunc log,
GkrellmLogInitFunc init,
GkrellmLogCleanupFunc cleanup);
/**
* Unregisters a log function
*
* Also calls the GkrellmLogCleanupFunc passed together with @p log
* in gkrellm_log_register().
**/
gboolean gkrellm_log_unregister(GkrellmLogFunc log);
/**
* Enables or disables logging into a file
*
* @param filename path to logfile or NULL to disable logging into a file
**/
void gkrellm_log_set_filename(const gchar* filename);
#endif //GK_LOG_P_H
/* GKrellM
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
|
|
| GKrellM 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 3 of the License, or
| (at your option) any later version.
|
| GKrellM 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, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#ifndef GK_LOG_P_H
#define GK_LOG_P_H
#include <glib.h>
typedef void (*GkrellmLogFunc) (GLogLevelFlags log_level, const gchar *message);
typedef gboolean (*GkrellmLogInitFunc) (void);
typedef gboolean (*GkrellmLogCleanupFunc) (void);
/**
* Installs a log handler and adds default logging behaviour.
*
* All GLib log functions and macros (i..e g_log(), g_debug(), g_warning() etc)
* are handled by our log handler from now on
**/
void gkrellm_log_init(void);
/**
* Removes our log handler reverting to default GLib log behaviour.
**/
void gkrellm_log_cleanup(void);
/**
* Registers another log function.
*
* Calls function @p init if it's not NULL and registers function @p log if
* the (optional) call to @p init was successful.
*
* @note This is mainly used by gkrellmd to register an additional
* syslog handler.
**/
gboolean gkrellm_log_register(
GkrellmLogFunc log,
GkrellmLogInitFunc init,
GkrellmLogCleanupFunc cleanup);
/**
* Unregisters a log function
*
* Also calls the GkrellmLogCleanupFunc passed together with @p log
* in gkrellm_log_register().
**/
gboolean gkrellm_log_unregister(GkrellmLogFunc log);
/**
* Enables or disables logging into a file
*
* @param filename path to logfile or NULL to disable logging into a file
**/
void gkrellm_log_set_filename(const gchar* filename);
#endif //GK_LOG_P_H

View File

@ -1,288 +1,300 @@
/* GKrellM
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Stefan Gehn stefan.gkrellm@srcbox.net
| Latest versions might be found at: http://gkrellm.net
|
|
| GKrellM 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 3 of the License, or
| (at your option) any later version.
|
| GKrellM 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, see http://www.gnu.org/licenses/
*/
/*
Wanted logic:
- g_print for user-visible messages, --version and --help fall into this category.
g_print usage should be kept at a minimum because
gkrellm is a gui-app, while gkrellmd is a daemon. Neither of them is suited
for terminal-interaction.
- gkrellm_debug(DEBUG_FOO, "msg"); for all debug messages.
- g_warning("msg") for all failed function calls etc.
Output should go to:
- g_print : gui-window or stdout where applicable
- gkrellm_debug : gui-window or logfile if set
- gkrellm_warning: gui-window or logfile if set
*/
#include "log.h"
#include "log-private.h"
#include <stdio.h>
// Include gkrellm headers to access _GK struct inside gkrellm_debug()
#if defined(GKRELLM_SERVER)
#include "../server/gkrellmd.h"
#include "../server/gkrellmd-private.h"
#else
#include "../src/gkrellm.h"
#include "../src/gkrellm-private.h"
#endif
typedef struct _GkrellmLogFacility
{
GkrellmLogFunc log;
GkrellmLogCleanupFunc cleanup;
} GkrellmLogFacility;
static GPtrArray *s_log_facility_ptr_array = NULL;
// ----------------------------------------------------------------------------
// Logging into a logfile
/**
* Handle to a logfile.
* Set by gkrellm_log_set_filename() and used by gkrellm_log_to_file()
**/
static FILE *s_gkrellm_logfile = NULL;
static gboolean
gkrellm_log_file_cleanup()
{
if (s_gkrellm_logfile)
fclose(s_gkrellm_logfile);
s_gkrellm_logfile = NULL;
return TRUE;
}
static void
gkrellm_log_file_log(GLogLevelFlags log_level, const gchar *message)
{
time_t raw_time;
char *local_time_str;
if (!s_gkrellm_logfile)
return;
// Prepend log message with current date/time
time(&raw_time);
local_time_str = ctime(&raw_time);
local_time_str[24] = ' '; // overwrite newline with space
fputs(local_time_str, s_gkrellm_logfile);
fputs(message, s_gkrellm_logfile);
fflush(s_gkrellm_logfile);
}
void
gkrellm_log_set_filename(const gchar* filename)
{
// Remove from logging chain if we already had been registered before
// This also cleans up an open logfile.
gkrellm_log_unregister(gkrellm_log_file_log);
if (filename && filename[0] != '\0')
{
// Open the file to log into
s_gkrellm_logfile = fopen(filename, "at");
// Add our callbacks to logging chain
if (s_gkrellm_logfile)
{
gkrellm_log_register(gkrellm_log_file_log, NULL,
gkrellm_log_file_cleanup);
}
}
}
// ----------------------------------------------------------------------------
//! Logs onto stdout/stderr
static void
gkrellm_log_to_terminal(GLogLevelFlags log_level, const gchar *message)
{
// warning, error or critical go to stderr
if (log_level & G_LOG_LEVEL_WARNING
|| log_level & G_LOG_LEVEL_CRITICAL
|| log_level & G_LOG_LEVEL_ERROR)
{
fputs(message, stderr);
return;
}
#if defined(WIN32)
// debug on windows gets special treatment
if (log_level & G_LOG_LEVEL_DEBUG)
OutputDebugStringA(message);
#endif
// Everything also ends up on stdout
// (may be invisible on most desktop-systems, especially on windows!)
fputs(message, stdout);
}
// ----------------------------------------------------------------------------
//! Handler that receives all the log-messages first
static void
gkrellm_log_handler(const gchar *log_domain, GLogLevelFlags log_level,
const gchar *message, gpointer user_data)
{
gchar *localized_message;
gint i;
GkrellmLogFacility *f;
localized_message = g_locale_from_utf8(message, -1, NULL, NULL, NULL);
if (localized_message == NULL)
{
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
f->log(log_level, message);
}
}
else
{
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
f->log(log_level, localized_message);
}
g_free(localized_message);
}
}
// ----------------------------------------------------------------------------
// Non-Static functions that can be used in gkrellm
void
gkrellm_log_init()
{
if (s_log_facility_ptr_array)
return; // already initialized
s_log_facility_ptr_array = g_ptr_array_new();
g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION, gkrellm_log_handler, NULL);
gkrellm_log_register(gkrellm_log_to_terminal, NULL, NULL);
}
void
gkrellm_log_cleanup()
{
gint i;
GkrellmLogFacility *f;
if (!s_log_facility_ptr_array)
return; // gkrellm_log_init() not called yet
// Call cleanup on all log-facilities and free our internal struct
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
if (f->cleanup != NULL)
f->cleanup();
g_free(f);
}
g_ptr_array_free(s_log_facility_ptr_array, TRUE);
s_log_facility_ptr_array = NULL;
}
gboolean
gkrellm_log_register(
GkrellmLogFunc log,
GkrellmLogInitFunc init,
GkrellmLogCleanupFunc cleanup)
{
GkrellmLogFacility *f;
gint i;
if (!s_log_facility_ptr_array)
return FALSE; // gkrellm_log_init() not called yet
// Check if log callback is already regisrered
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
if (f->log == log)
return TRUE;
}
if (init != NULL && init() == FALSE)
return FALSE;
// remember logging function and cleanup function in a struct
f = g_new0(GkrellmLogFacility, 1);
f->log = log;
f->cleanup = cleanup;
// add struct to list of log facilities
g_ptr_array_add(s_log_facility_ptr_array, (gpointer)f);
return TRUE;
}
gboolean
gkrellm_log_unregister(GkrellmLogFunc log)
{
gint i;
GkrellmLogFacility *f;
if (!s_log_facility_ptr_array)
return FALSE; // gkrellm_log_init() not called yet
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
if (f->log == log)
{
if (f->cleanup != NULL)
f->cleanup();
g_ptr_array_remove_index(s_log_facility_ptr_array, i);
g_free(f);
return TRUE;
}
}
return FALSE;
}
// ----------------------------------------------------------------------------
// Public functions that can be used in gkrellm and plugins
void
gkrellm_debug(guint debug_level, const gchar *format, ...)
{
if (_GK.debug_level & debug_level)
{
va_list varargs;
va_start(varargs, format);
g_logv(NULL, G_LOG_LEVEL_DEBUG, format, varargs);
va_end(varargs);
}
}
/* GKrellM
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Stefan Gehn stefan.gkrellm@srcbox.net
| Latest versions might be found at: http://gkrellm.net
|
|
| GKrellM 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 3 of the License, or
| (at your option) any later version.
|
| GKrellM 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, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
/*
Wanted logic:
- g_print for user-visible messages, --version and --help fall into this category.
g_print usage should be kept at a minimum because
gkrellm is a gui-app, while gkrellmd is a daemon. Neither of them is suited
for terminal-interaction.
- gkrellm_debug(DEBUG_FOO, "msg"); for all debug messages.
- g_warning("msg") for all failed function calls etc.
Output should go to:
- g_print : gui-window or stdout where applicable
- gkrellm_debug : gui-window or logfile if set
- gkrellm_warning: gui-window or logfile if set
*/
#include "log.h"
#include "log-private.h"
#include <stdio.h>
// Include gkrellm headers to access _GK struct inside gkrellm_debug()
#if defined(GKRELLM_SERVER)
#include "../server/gkrellmd.h"
#include "../server/gkrellmd-private.h"
#else
#include "../src/gkrellm.h"
#include "../src/gkrellm-private.h"
#endif
typedef struct _GkrellmLogFacility
{
GkrellmLogFunc log;
GkrellmLogCleanupFunc cleanup;
} GkrellmLogFacility;
static GPtrArray *s_log_facility_ptr_array = NULL;
// ----------------------------------------------------------------------------
// Logging into a logfile
/**
* Handle to a logfile.
* Set by gkrellm_log_set_filename() and used by gkrellm_log_to_file()
**/
static FILE *s_gkrellm_logfile = NULL;
static gboolean
gkrellm_log_file_cleanup()
{
if (s_gkrellm_logfile)
fclose(s_gkrellm_logfile);
s_gkrellm_logfile = NULL;
return TRUE;
}
static void
gkrellm_log_file_log(GLogLevelFlags log_level, const gchar *message)
{
time_t raw_time;
char *local_time_str;
if (!s_gkrellm_logfile)
return;
// Prepend log message with current date/time
time(&raw_time);
local_time_str = ctime(&raw_time);
local_time_str[24] = ' '; // overwrite newline with space
fputs(local_time_str, s_gkrellm_logfile);
fputs(message, s_gkrellm_logfile);
fflush(s_gkrellm_logfile);
}
void
gkrellm_log_set_filename(const gchar* filename)
{
// Remove from logging chain if we already had been registered before
// This also cleans up an open logfile.
gkrellm_log_unregister(gkrellm_log_file_log);
if (filename && filename[0] != '\0')
{
// Open the file to log into
s_gkrellm_logfile = fopen(filename, "at");
// Add our callbacks to logging chain
if (s_gkrellm_logfile)
{
gkrellm_log_register(gkrellm_log_file_log, NULL,
gkrellm_log_file_cleanup);
}
}
}
// ----------------------------------------------------------------------------
//! Logs onto stdout/stderr
static void
gkrellm_log_to_terminal(GLogLevelFlags log_level, const gchar *message)
{
// warning, error or critical go to stderr
if (log_level & G_LOG_LEVEL_WARNING
|| log_level & G_LOG_LEVEL_CRITICAL
|| log_level & G_LOG_LEVEL_ERROR)
{
fputs(message, stderr);
return;
}
#if defined(WIN32)
// debug on windows gets special treatment
if (log_level & G_LOG_LEVEL_DEBUG)
OutputDebugStringA(message);
#endif
// Everything also ends up on stdout
// (may be invisible on most desktop-systems, especially on windows!)
fputs(message, stdout);
}
// ----------------------------------------------------------------------------
//! Handler that receives all the log-messages first
static void
gkrellm_log_handler(const gchar *log_domain, GLogLevelFlags log_level,
const gchar *message, gpointer user_data)
{
gchar *localized_message;
gint i;
GkrellmLogFacility *f;
localized_message = g_locale_from_utf8(message, -1, NULL, NULL, NULL);
if (localized_message == NULL)
{
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
f->log(log_level, message);
}
}
else
{
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
f->log(log_level, localized_message);
}
g_free(localized_message);
}
}
// ----------------------------------------------------------------------------
// Non-Static functions that can be used in gkrellm
void
gkrellm_log_init()
{
if (s_log_facility_ptr_array)
return; // already initialized
s_log_facility_ptr_array = g_ptr_array_new();
g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION, gkrellm_log_handler, NULL);
gkrellm_log_register(gkrellm_log_to_terminal, NULL, NULL);
}
void
gkrellm_log_cleanup()
{
gint i;
GkrellmLogFacility *f;
if (!s_log_facility_ptr_array)
return; // gkrellm_log_init() not called yet
// Call cleanup on all log-facilities and free our internal struct
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
if (f->cleanup != NULL)
f->cleanup();
g_free(f);
}
g_ptr_array_free(s_log_facility_ptr_array, TRUE);
s_log_facility_ptr_array = NULL;
}
gboolean
gkrellm_log_register(
GkrellmLogFunc log,
GkrellmLogInitFunc init,
GkrellmLogCleanupFunc cleanup)
{
GkrellmLogFacility *f;
gint i;
if (!s_log_facility_ptr_array)
return FALSE; // gkrellm_log_init() not called yet
// Check if log callback is already regisrered
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
if (f->log == log)
return TRUE;
}
if (init != NULL && init() == FALSE)
return FALSE;
// remember logging function and cleanup function in a struct
f = g_new0(GkrellmLogFacility, 1);
f->log = log;
f->cleanup = cleanup;
// add struct to list of log facilities
g_ptr_array_add(s_log_facility_ptr_array, (gpointer)f);
return TRUE;
}
gboolean
gkrellm_log_unregister(GkrellmLogFunc log)
{
gint i;
GkrellmLogFacility *f;
if (!s_log_facility_ptr_array)
return FALSE; // gkrellm_log_init() not called yet
for (i = 0; i < s_log_facility_ptr_array->len; i++)
{
f = (g_ptr_array_index(s_log_facility_ptr_array, i));
if (f->log == log)
{
if (f->cleanup != NULL)
f->cleanup();
g_ptr_array_remove_index(s_log_facility_ptr_array, i);
g_free(f);
return TRUE;
}
}
return FALSE;
}
// ----------------------------------------------------------------------------
// Public functions that can be used in gkrellm and plugins
void
gkrellm_debug(guint debug_level, const gchar *format, ...)
{
if (_GK.debug_level & debug_level)
{
va_list varargs;
va_start(varargs, format);
g_logv(NULL, G_LOG_LEVEL_DEBUG, format, varargs);
va_end(varargs);
}
}

View File

@ -1,36 +1,48 @@
/* GKrellM
* Copyright (C) 1999-2008 Bill Wilson
*
* @author Bill Wilson <billw@gkrellm.net>
*
| Latest versions might be found at: http://gkrellm.net
|
|
| GKrellM 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 3 of the License, or
| (at your option) any later version.
|
| GKrellM 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, see http://www.gnu.org/licenses/
*/
#ifndef GK_LOG_H
#define GK_LOG_H
#include <glib.h>
/**
* @brief Prints our and/or logs a debug message.
*
* If a logfile was set @see gkrellm_log_set_filename() the message will
* be logged into the logfile as well.
**/
void gkrellm_debug(guint debug_level, const gchar *format, ...);
#endif //GK_LOG_H
/* GKrellM
* Copyright (C) 1999-2008 Bill Wilson
*
* @author Bill Wilson <billw@gkrellm.net>
*
| Latest versions might be found at: http://gkrellm.net
|
|
| GKrellM 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 3 of the License, or
| (at your option) any later version.
|
| GKrellM 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, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#ifndef GK_LOG_H
#define GK_LOG_H
#include <glib.h>
/**
* @brief Prints our and/or logs a debug message.
*
* If a logfile was set @see gkrellm_log_set_filename() the message will
* be logged into the logfile as well.
**/
void gkrellm_debug(guint debug_level, const gchar *format, ...);
#endif //GK_LOG_H

View File

@ -49,6 +49,7 @@ DUMMY_VAR := $(shell ./configure $(CONFIGURE_ARGS))
HAVE_GNUTLS = $(shell grep -c HAVE_GNUTLS configure.h)
HAVE_SSL = $(shell grep -c HAVE_SSL configure.h)
HAVE_NTLM = $(shell grep -c HAVE_NTLM configure.h)
HAVE_LIBSENSORS = $(shell grep -c HAVE_LIBSENSORS configure.h)
ifeq ($(HAVE_GNUTLS),1)
@ -61,6 +62,10 @@ else
endif
endif
ifeq ($(HAVE_NTLM),1)
NTLM_LIBS ?= -lntlm
endif
ifeq ($(HAVE_LIBSENSORS),1)
SENSORS_LIBS ?= -lsensors
endif
@ -76,7 +81,7 @@ PKG_LIB = `$(PKG_CONFIG) --libs gtk+-2.0 gthread-2.0`
FLAGS = -O2 -I.. -I$(SHARED_PATH) $(PKG_INCLUDE) $(GTOP_INCLUDE) $(PTHREAD_INC) \
-DGKRELLM_CLIENT
LIBS = $(PKG_LIB) $(GTOP_LIBS) $(SMC_LIBS) $(SYS_LIBS) $(SSL_LIBS) $(SENSORS_LIBS)
LIBS = $(PKG_LIB) $(GTOP_LIBS) $(SMC_LIBS) $(SYS_LIBS) $(SSL_LIBS) $(NTLM_LIBS) $(SENSORS_LIBS)
ifeq ($(debug),1)
FLAGS += -g
@ -113,7 +118,6 @@ override CC += -Wall $(FLAGS)
OBJS = main.o alerts.o battery.o base64.o clock.o cpu.o disk.o fs.o \
hostname.o inet.o mail.o mem.o net.o proc.o sensors.o uptime.o \
chart.o panel.o config.o gui.o krell.o plugins.o pixops.o \
smbdes.o smbencrypt.o smbmd4.o smbutil.o \
client.o utils.o sysdeps-unix.o deprecated.o log.o
UNIXOBJS = winops-x11.o
@ -319,12 +323,8 @@ disk.o: disk.c $(GKRELLM_H_SYS)
fs.o: fs.c $(GKRELLM_H_SYS)
hostname.o: hostname.c $(GKRELLM_H_SYS)
inet.o: inet.c $(GKRELLM_H_SYS)
mail.o: mail.c md5.h md5global.h ntlm.h $(GKRELLM_H_SYS)
md5c.o: md5.h md5global.h
smbdes.o: smbdes.h
smbencrypt.o: smbbyteorder.h smbdes.h smbmd4.h
smbmd4.o: smbmd4.h
smbutil.o: ntlm.h smbencrypt.h smbbyteorder.h
mail.o: mail.c md5.h $(GKRELLM_H_SYS)
md5c.o: md5.h
mem.o: mem.c $(GKRELLM_H_SYS)
net.o: net.c $(GKRELLM_H_SYS)
proc.o: proc.c $(GKRELLM_H_SYS)

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"
@ -33,10 +45,13 @@
#else
#define DEFAULT_CLOCK_FORMAT "%l:%M <span foreground=\"$A\"><small>%S</small></span>"
#define DEFAULT_CLOCK_FORMAT \
_("%l:%M <span foreground=\"$A\"><small>%S</small></span>")
#define ALT1_CLOCK_FORMAT "%l:%M <span foreground=\"$A\"><small>%p</small></span>"
#define ALT2_CLOCK_FORMAT "%k:%M <span foreground=\"$A\"><small>%S</small></span>"
#define DEFAULT_CAL_FORMAT "%a <span foreground=\"$A\"><big><big>%e</big></big></span> %b"
#define DEFAULT_CAL_FORMAT \
_("%a <span foreground=\"$A\"><big><big>%e</big></big></span> %b")
#define ALT1_CAL_FORMAT "<big>%a %b <span foreground=\"$A\">%e</span></big>"
#define ALT2_CAL_FORMAT "%a <span foreground=\"cyan2\"><span font_desc=\"16.5\"><i>%e</i></span></span> %b"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"
@ -499,7 +511,7 @@ assign_style(gchar *debug_name, GList *style_list, gint index,
if (index++ == 0) /* style == style_list */
{
if (override)
g_warning(_("Bad override on DEFAULT: %s %s %d\n"),
g_warning("Bad override on DEFAULT: %s %s %d\n",
debug_name, arg, entry_flag);
for (list = style_list->next; list; list = list->next, ++index)
{
@ -632,7 +644,7 @@ assign_gkrellmrc_style(gchar *source_line, gchar *area, gchar *string)
}
if (!mon_name || !entry || !*entry || !arg)
{
g_warning(_("StyleXXX ?: %s\n"), source_line);
g_warning("StyleXXX ?: %s\n", source_line);
g_free(custom_name);
return;
}
@ -655,7 +667,7 @@ assign_gkrellmrc_style(gchar *source_line, gchar *area, gchar *string)
}
else
{
g_warning(_("StyleXXX ?: %s\n"), source_line);
g_warning("StyleXXX ?: %s\n", source_line);
g_free(custom_name);
return;
}
@ -2238,8 +2250,8 @@ gkrellm_theme_config(void)
*/
if (!_GK.use_top_bottom_margins && _GK.command_line_theme)
{
g_warning(_("Top and bottom meter/panel margins are not set.\n" \
" Do not depend on borders!\n"));
g_warning("Top and bottom meter/panel margins are not set.\n" \
" Do not depend on borders!\n");
}
}
@ -2509,7 +2521,7 @@ gkrellm_save_user_config(void)
i = rename(config_new, config);
if (i != 0)
{
g_warning(_("Cannot rename new config file %s to %s.\n"), config_new, config);
g_warning("Cannot rename new config file %s to %s.\n", config_new, config);
g_free(config);
g_free(config_new);
// NOTE: _GK.config_modified will stay true because saving failed

32
src/configure vendored
View File

@ -119,6 +119,38 @@ fi
# end of gnutls check
rm -f test test.exe test.o test.c
# echo "Checking for libntlm... " 1>& 2
echo "Checking for libntlm... " 1>& 5
cat << EOF > test.c
#include <ntlm.h>
int main()
{
tSmbNtlmAuthRequest request;
buildSmbNtlmAuthRequest(&request, "username", NULL);
return 0;
}
EOF
$CC ${CFLAGS} ${PKG_INCLUDE} -c test.c -o test.o 2>& 5
$CC test.o -o test ${LINK_FLAGS} ${PKG_LIBS} -lntlm 2>& 5
if [ -x ./test ] && ./test
then
# echo 'Defining HAVE_NTLM' 1>& 2
echo 'Defining HAVE_NTLM' 1>& 5
echo '#define HAVE_NTLM 1' >> configure.h
else
# echo "Not found, mail check will not have ntlm support..." 1>& 2
echo "Not found, mail check will not have ntlm support..." 1>& 5
fi
rm -f test test.exe test.o test.c
if [ "$without_libsensors" != "yes" ]

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include <string.h>

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "configure.h"
@ -65,7 +77,8 @@ struct GkrellmConfig
gint demo;
gint test;
gboolean nolock;
gboolean without_libsensors;
gboolean without_libsensors; /* transition override */
gboolean use_acpi_battery; /* transition override */
gboolean config_clean;
gint up_minutes;

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
/* These functions define the GKrellM interface to the system dependent

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#if !defined(WIN32)

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"
@ -56,7 +68,9 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
#endif
#endif
#include "ntlm.h"
#if defined(HAVE_NTLM)
#include <ntlm.h>
#endif
#define MUTE_FLAG -1
@ -127,16 +141,16 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
#define PROTO_POP3 0
#define PROTO_IMAP 1
#define AUTH_PLAINTEXT 0
#define AUTH_USER AUTH_PLAINTEXT /* POP3 only */
#define AUTH_APOP 1 /* POP3 only */
#define AUTH_LOGIN AUTH_PLAINTEXT /* IMAP4 only */
#define AUTH_CRAM_MD5 2
#define AUTH_PLAINTEXT 0
#define AUTH_USER AUTH_PLAINTEXT /* POP3 only */
#define AUTH_APOP 1 /* POP3 only */
#define AUTH_LOGIN AUTH_PLAINTEXT /* IMAP4 only */
#define AUTH_CRAM_MD5 2
#define AUTH_NTLM 3
#define SSL_NONE 0
#define SSL_TRANSPORT 1
#define SSL_STARTTLS 2
#define SSL_TRANSPORT 1
#define SSL_STARTTLS 2
/* Authorization protocol strings to write into the config for remote
@ -152,14 +166,18 @@ typedef struct
static AuthType auth_strings[] =
{
{ "POP3", PROTO_POP3, AUTH_USER },
{ "POP3", PROTO_POP3, AUTH_USER },
{ "POP3_(APOP)", PROTO_POP3, AUTH_APOP },
{ "POP3_(CRAM-MD5)", PROTO_POP3, AUTH_CRAM_MD5 },
{ "POP3_(CRAM-MD5)",PROTO_POP3, AUTH_CRAM_MD5 },
#ifdef HAVE_NTLM
{ "POP3_(NTLM)", PROTO_POP3, AUTH_NTLM },
{ "IMAP", PROTO_IMAP, AUTH_LOGIN },
{ "IMAP_(CRAM-MD5)", PROTO_IMAP, AUTH_CRAM_MD5 },
#endif
{ "IMAP", PROTO_IMAP, AUTH_LOGIN },
{ "IMAP_(CRAM-MD5)",PROTO_IMAP, AUTH_CRAM_MD5 },
#ifdef HAVE_NTLM
{ "IMAP_(NTLM)", PROTO_IMAP, AUTH_NTLM },
{ NULL, -1, -1 }
#endif
{ NULL, -1, -1 }
};
@ -916,6 +934,7 @@ do_cram_md5(ConnInfo *conn, char *command, Mailbox *mbox, char *strip)
return TRUE;
}
#ifdef HAVE_NTLM
/* NTLM authentication */
static int
do_ntlm(ConnInfo *conn, char *command, Mailbox *mbox)
@ -971,6 +990,7 @@ do_ntlm(ConnInfo *conn, char *command, Mailbox *mbox)
server_command(conn, mbox, msgbuf);
return TRUE;
}
#endif // HAVE_NTLM
static gboolean
check_pop3(Mailbox *mbox)
@ -1060,6 +1080,7 @@ check_pop3(Mailbox *mbox)
return tcp_shutdown(&conn, mbox, tcp_error_message[7], TRUE);
}
}
#ifdef HAVE_NTLM
else if (account->authmech == AUTH_NTLM)
{
if (!do_ntlm(&conn, "AUTH", mbox))
@ -1069,6 +1090,7 @@ check_pop3(Mailbox *mbox)
return tcp_shutdown(&conn, mbox, tcp_error_message[7], TRUE);
}
}
#endif // HAVE_NTLM
else /* AUTH_USER */
{
snprintf (line, sizeof (line), "USER %s\r\n", account->username);
@ -1159,6 +1181,7 @@ check_imap(Mailbox *mbox)
return tcp_shutdown(&conn, mbox, tcp_error_message[7], TRUE);
}
}
#ifdef HAVE_NTLM
else if (account->authmech == AUTH_NTLM)
{
snprintf(line, sizeof(line), "a%03d AUTHENTICATE", ++seq);
@ -1169,6 +1192,7 @@ check_imap(Mailbox *mbox)
return tcp_shutdown(&conn, mbox, tcp_error_message[7], TRUE);
}
}
#endif // HAVE_NTLM
else /* AUTH_LOGIN */
{
snprintf(line, sizeof(line), "a%03d LOGIN \"%s\" \"%s\"\r\n",

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"
@ -1792,6 +1804,7 @@ N_(" --nolock Allow multiple gkrellm instances.\n"),
N_(" -p, --plugin plugin.so While developing, load your plugin under test.\n"),
N_(" --demo Force enabling of many monitors so themers can\n"
" see everything. All config saving is inhibited.\n"),
" -l, --logfile path Enable error/debugging to a log file.\n",
N_(" -v, --version Print GKrellM version number and exit.\n"),
N_(" -d, --debug-level n Turn debugging on for selective code sections.\n"),
@ -2139,8 +2152,10 @@ main(gint argc, gchar **argv)
}
else if (!strcmp(s, "nolock"))
_GK.nolock = TRUE;
else if (!strcmp(s, "without-libsensors"))
else if (!strcmp(s, "without-libsensors")) /* temporary */
_GK.without_libsensors = TRUE;
else if (!strcmp(s, "use-acpi-battery")) /* temporary */
_GK.use_acpi_battery = TRUE;
else if (!strcmp(s, "config-clean"))
{
_GK.config_clean = TRUE;

View File

@ -1,41 +0,0 @@
/*
* For license terms, see the file COPYRIGHT in the parent directory.
*
* md5global.h Global declarations for MD5 module used by fetchmail
*
*/
#ifndef MD5GLOBAL_H__
#define MD5GLOBAL_H__
/* GLOBAL.H - RSAREF types and constants
*/
/* force prototypes on, we need ANSI C anyway */
#ifndef PROTOTYPES
#define PROTOTYPES 1
#endif
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
#if SIZEOF_INT == 4
typedef unsigned int UINT4;
#else
typedef unsigned long int UINT4;
#endif
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
#endif /* MD5GLOBAL_H__ */

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,75 +0,0 @@
/* ntlm.h -- interface declarations for SMB authentication code */
#ifndef uint32_defined
#define uint32_defined
typedef unsigned int uint32;
#endif
typedef unsigned short uint16;
typedef unsigned char uint8;
/*
* These structures are byte-order dependant, and should not
* be manipulated except by the use of the routines provided
*/
typedef struct
{
uint16 len;
uint16 maxlen;
uint32 offset;
}tSmbStrHeader;
typedef struct
{
char ident[8];
uint32 msgType;
uint32 flags;
tSmbStrHeader user;
tSmbStrHeader domain;
uint8 buffer[1024];
uint32 bufIndex;
}tSmbNtlmAuthRequest;
typedef struct
{
char ident[8];
uint32 msgType;
tSmbStrHeader uDomain;
uint32 flags;
uint8 challengeData[8];
uint8 reserved[8];
tSmbStrHeader emptyString;
uint8 buffer[1024];
uint32 bufIndex;
}tSmbNtlmAuthChallenge;
typedef struct
{
char ident[8];
uint32 msgType;
tSmbStrHeader lmResponse;
tSmbStrHeader ntResponse;
tSmbStrHeader uDomain;
tSmbStrHeader uUser;
tSmbStrHeader uWks;
tSmbStrHeader sessionKey;
uint32 flags;
uint8 buffer[1024];
uint32 bufIndex;
}tSmbNtlmAuthResponse;
/* public: */
#define SmbLength(ptr) (((ptr)->buffer - (uint8*)(ptr)) + (ptr)->bufIndex)
extern void dumpSmbNtlmAuthRequest(FILE *fp, tSmbNtlmAuthRequest *request);
extern void dumpSmbNtlmAuthChallenge(FILE *fp, tSmbNtlmAuthChallenge *challenge);
extern void dumpSmbNtlmAuthResponse(FILE *fp, tSmbNtlmAuthResponse *response);
extern void buildSmbNtlmAuthRequest(tSmbNtlmAuthRequest *request, char *user, char *domain);
extern void buildSmbNtlmAuthResponse(tSmbNtlmAuthChallenge *challenge, tSmbNtlmAuthResponse *response, char *user, char *password);
/* ntlm.h ends here */

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,52 +0,0 @@
typedef unsigned short uint16;
typedef unsigned uint32;
typedef unsigned char uint8;
typedef struct
{
uint16 len;
uint16 maxlen;
uint32 offset;
}tSmbStrHeader;
typedef struct
{
char ident[8];
uint32 msgType;
uint32 flags;
tSmbStrHeader user;
tSmbStrHeader domain;
uint8 buffer[1024];
uint32 bufIndex;
}tSmbNtlmAuthRequest;
typedef struct
{
char ident[8];
uint32 msgType;
tSmbStrHeader uDomain;
uint32 flags;
uint8 challengeData[8];
uint8 reserved[8];
tSmbStrHeader emptyString;
uint8 buffer[1024];
uint32 bufIndex;
}tSmbNtlmAuthChallenge;
typedef struct
{
char ident[8];
uint32 msgType;
tSmbStrHeader lmResponse;
tSmbStrHeader ntResponse;
tSmbStrHeader uDomain;
tSmbStrHeader uUser;
tSmbStrHeader uWks;
tSmbStrHeader sessionKey;
uint32 flags;
uint8 buffer[1024];
uint32 bufIndex;
}tSmbNtlmAuthResponse;
#define SmbLength(ptr) (((ptr)->buffer - (uint8*)(ptr)) + (ptr)->bufIndex)

View File

@ -1,265 +0,0 @@
/*
Unix SMB/Netbios implementation.
Version 1.9.
SMB Byte handling
Copyright (C) Andrew Tridgell 1992-1998
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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _BYTEORDER_H
#define _BYTEORDER_H
/*
This file implements macros for machine independent short and
int manipulation
Here is a description of this file that I emailed to the samba list once:
> I am confused about the way that byteorder.h works in Samba. I have
> looked at it, and I would have thought that you might make a distinction
> between LE and BE machines, but you only seem to distinguish between 386
> and all other architectures.
>
> Can you give me a clue?
sure.
The distinction between 386 and other architectures is only there as
an optimisation. You can take it out completely and it will make no
difference. The routines (macros) in byteorder.h are totally byteorder
independent. The 386 optimsation just takes advantage of the fact that
the x86 processors don't care about alignment, so we don't have to
align ints on int boundaries etc. If there are other processors out
there that aren't alignment sensitive then you could also define
CAREFUL_ALIGNMENT=0 on those processors as well.
Ok, now to the macros themselves. I'll take a simple example, say we
want to extract a 2 byte integer from a SMB packet and put it into a
type called uint16 that is in the local machines byte order, and you
want to do it with only the assumption that uint16 is _at_least_ 16
bits long (this last condition is very important for architectures
that don't have any int types that are 2 bytes long)
You do this:
#define CVAL(buf,pos) (((unsigned char *)(buf))[pos])
#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
then to extract a uint16 value at offset 25 in a buffer you do this:
char *buffer = foo_bar();
uint16 xx = SVAL(buffer,25);
We are using the byteoder independence of the ANSI C bitshifts to do
the work. A good optimising compiler should turn this into efficient
code, especially if it happens to have the right byteorder :-)
I know these macros can be made a bit tidier by removing some of the
casts, but you need to look at byteorder.h as a whole to see the
reasoning behind them. byteorder.h defines the following macros:
SVAL(buf,pos) - extract a 2 byte SMB value
IVAL(buf,pos) - extract a 4 byte SMB value
SVALS(buf,pos) signed version of SVAL()
IVALS(buf,pos) signed version of IVAL()
SSVAL(buf,pos,val) - put a 2 byte SMB value into a buffer
SIVAL(buf,pos,val) - put a 4 byte SMB value into a buffer
SSVALS(buf,pos,val) - signed version of SSVAL()
SIVALS(buf,pos,val) - signed version of SIVAL()
RSVAL(buf,pos) - like SVAL() but for NMB byte ordering
RSVALS(buf,pos) - like SVALS() but for NMB byte ordering
RIVAL(buf,pos) - like IVAL() but for NMB byte ordering
RIVALS(buf,pos) - like IVALS() but for NMB byte ordering
RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering
RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering
RSIVALS(buf,pos,val) - like SIVALS() but for NMB ordering
it also defines lots of intermediate macros, just ignore those :-)
*/
/* some switch macros that do both store and read to and from SMB buffers */
#define RW_PCVAL(read,inbuf,outbuf,len) \
{ if (read) { PCVAL (inbuf,0,outbuf,len); } \
else { PSCVAL(inbuf,0,outbuf,len); } }
#define RW_PIVAL(read,big_endian,inbuf,outbuf,len) \
{ if (read) { if (big_endian) { RPIVAL(inbuf,0,outbuf,len); } else { PIVAL(inbuf,0,outbuf,len); } } \
else { if (big_endian) { RPSIVAL(inbuf,0,outbuf,len); } else { PSIVAL(inbuf,0,outbuf,len); } } }
#define RW_PSVAL(read,big_endian,inbuf,outbuf,len) \
{ if (read) { if (big_endian) { RPSVAL(inbuf,0,outbuf,len); } else { PSVAL(inbuf,0,outbuf,len); } } \
else { if (big_endian) { RPSSVAL(inbuf,0,outbuf,len); } else { PSSVAL(inbuf,0,outbuf,len); } } }
#define RW_CVAL(read, inbuf, outbuf, offset) \
{ if (read) { (outbuf) = CVAL (inbuf,offset); } \
else { SCVAL(inbuf,offset,outbuf); } }
#define RW_IVAL(read, big_endian, inbuf, outbuf, offset) \
{ if (read) { (outbuf) = ((big_endian) ? RIVAL(inbuf,offset) : IVAL (inbuf,offset)); } \
else { if (big_endian) { RSIVAL(inbuf,offset,outbuf); } else { SIVAL(inbuf,offset,outbuf); } } }
#define RW_SVAL(read, big_endian, inbuf, outbuf, offset) \
{ if (read) { (outbuf) = ((big_endian) ? RSVAL(inbuf,offset) : SVAL (inbuf,offset)); } \
else { if (big_endian) { RSSVAL(inbuf,offset,outbuf); } else { SSVAL(inbuf,offset,outbuf); } } }
#undef CAREFUL_ALIGNMENT
/* we know that the 386 can handle misalignment and has the "right"
byteorder */
#ifdef __i386__
#define CAREFUL_ALIGNMENT 0
#endif
#ifndef CAREFUL_ALIGNMENT
#define CAREFUL_ALIGNMENT 1
#endif
#define CVAL(buf,pos) (((unsigned char *)(buf))[pos])
#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
#define SCVAL(buf,pos,val) (CVAL(buf,pos) = (val))
#if CAREFUL_ALIGNMENT
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16)
#define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8)
#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
#define SVALS(buf,pos) ((int16)SVAL(buf,pos))
#define IVALS(buf,pos) ((int32)IVAL(buf,pos))
#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16)(val)))
#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val)))
#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val)))
#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val)))
#else /* CAREFUL_ALIGNMENT */
/* this handles things for architectures like the 386 that can handle
alignment errors */
/*
WARNING: This section is dependent on the length of int16 and int32
being correct
*/
/* get single value from an SMB buffer */
#define SVAL(buf,pos) (*(uint16 *)((char *)(buf) + (pos)))
#define IVAL(buf,pos) (*(uint32 *)((char *)(buf) + (pos)))
#define SVALS(buf,pos) (*(int16 *)((char *)(buf) + (pos)))
#define IVALS(buf,pos) (*(int32 *)((char *)(buf) + (pos)))
/* store single value in an SMB buffer */
#define SSVAL(buf,pos,val) SVAL(buf,pos)=((uint16)(val))
#define SIVAL(buf,pos,val) IVAL(buf,pos)=((uint32)(val))
#define SSVALS(buf,pos,val) SVALS(buf,pos)=((int16)(val))
#define SIVALS(buf,pos,val) IVALS(buf,pos)=((int32)(val))
#endif /* CAREFUL_ALIGNMENT */
/* macros for reading / writing arrays */
#define SMBMACRO(macro,buf,pos,val,len,size) \
{ int l; for (l = 0; l < (len); l++) (val)[l] = macro((buf), (pos) + (size)*l); }
#define SSMBMACRO(macro,buf,pos,val,len,size) \
{ int l; for (l = 0; l < (len); l++) macro((buf), (pos) + (size)*l, (val)[l]); }
/* reads multiple data from an SMB buffer */
#define PCVAL(buf,pos,val,len) SMBMACRO(CVAL,buf,pos,val,len,1)
#define PSVAL(buf,pos,val,len) SMBMACRO(SVAL,buf,pos,val,len,2)
#define PIVAL(buf,pos,val,len) SMBMACRO(IVAL,buf,pos,val,len,4)
#define PCVALS(buf,pos,val,len) SMBMACRO(CVALS,buf,pos,val,len,1)
#define PSVALS(buf,pos,val,len) SMBMACRO(SVALS,buf,pos,val,len,2)
#define PIVALS(buf,pos,val,len) SMBMACRO(IVALS,buf,pos,val,len,4)
/* stores multiple data in an SMB buffer */
#define PSCVAL(buf,pos,val,len) SSMBMACRO(SCVAL,buf,pos,val,len,1)
#define PSSVAL(buf,pos,val,len) SSMBMACRO(SSVAL,buf,pos,val,len,2)
#define PSIVAL(buf,pos,val,len) SSMBMACRO(SIVAL,buf,pos,val,len,4)
#define PSCVALS(buf,pos,val,len) SSMBMACRO(SCVALS,buf,pos,val,len,1)
#define PSSVALS(buf,pos,val,len) SSMBMACRO(SSVALS,buf,pos,val,len,2)
#define PSIVALS(buf,pos,val,len) SSMBMACRO(SIVALS,buf,pos,val,len,4)
/* now the reverse routines - these are used in nmb packets (mostly) */
#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
#define RSVAL(buf,pos) SREV(SVAL(buf,pos))
#define RSVALS(buf,pos) SREV(SVALS(buf,pos))
#define RIVAL(buf,pos) IREV(IVAL(buf,pos))
#define RIVALS(buf,pos) IREV(IVALS(buf,pos))
#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
#define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val))
#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
#define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val))
/* reads multiple data from an SMB buffer (big-endian) */
#define RPSVAL(buf,pos,val,len) SMBMACRO(RSVAL,buf,pos,val,len,2)
#define RPIVAL(buf,pos,val,len) SMBMACRO(RIVAL,buf,pos,val,len,4)
#define RPSVALS(buf,pos,val,len) SMBMACRO(RSVALS,buf,pos,val,len,2)
#define RPIVALS(buf,pos,val,len) SMBMACRO(RIVALS,buf,pos,val,len,4)
/* stores multiple data in an SMB buffer (big-endian) */
#define RPSSVAL(buf,pos,val,len) SSMBMACRO(RSSVAL,buf,pos,val,len,2)
#define RPSIVAL(buf,pos,val,len) SSMBMACRO(RSIVAL,buf,pos,val,len,4)
#define RPSSVALS(buf,pos,val,len) SSMBMACRO(RSSVALS,buf,pos,val,len,2)
#define RPSIVALS(buf,pos,val,len) SSMBMACRO(RSIVALS,buf,pos,val,len,4)
#define DBG_RW_PCVAL(charmode,string,depth,base,read,inbuf,outbuf,len) \
{ RW_PCVAL(read,inbuf,outbuf,len) \
DEBUG(5,("%s%04x %s: ", \
tab_depth(depth), base,string)); \
if (charmode) print_asc(5, (unsigned char*)(outbuf), (len)); else \
{ int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%02x ", (outbuf)[idx])); } } \
DEBUG(5,("\n")); }
#define DBG_RW_PSVAL(charmode,string,depth,base,read,big_endian,inbuf,outbuf,len) \
{ RW_PSVAL(read,big_endian,inbuf,outbuf,len) \
DEBUG(5,("%s%04x %s: ", \
tab_depth(depth), base,string)); \
if (charmode) print_asc(5, (unsigned char*)(outbuf), 2*(len)); else \
{ int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%04x ", (outbuf)[idx])); } } \
DEBUG(5,("\n")); }
#define DBG_RW_PIVAL(charmode,string,depth,base,read,big_endian,inbuf,outbuf,len) \
{ RW_PIVAL(read,big_endian,inbuf,outbuf,len) \
DEBUG(5,("%s%04x %s: ", \
tab_depth(depth), base,string)); \
if (charmode) print_asc(5, (unsigned char*)(outbuf), 4*(len)); else \
{ int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%08x ", (outbuf)[idx])); } } \
DEBUG(5,("\n")); }
#define DBG_RW_CVAL(string,depth,base,read,inbuf,outbuf) \
{ RW_CVAL(read,inbuf,outbuf,0) \
DEBUG(5,("%s%04x %s: %02x\n", \
tab_depth(depth), base, string, outbuf)); }
#define DBG_RW_SVAL(string,depth,base,read,big_endian,inbuf,outbuf) \
{ RW_SVAL(read,big_endian,inbuf,outbuf,0) \
DEBUG(5,("%s%04x %s: %04x\n", \
tab_depth(depth), base, string, outbuf)); }
#define DBG_RW_IVAL(string,depth,base,read,big_endian,inbuf,outbuf) \
{ RW_IVAL(read,big_endian,inbuf,outbuf,0) \
DEBUG(5,("%s%04x %s: %08x\n", \
tab_depth(depth), base, string, outbuf)); }
#endif /* _BYTEORDER_H */

View File

@ -1,399 +0,0 @@
/*
Unix SMB/Netbios implementation.
Version 1.9.
a partial implementation of DES designed for use in the
SMB authentication protocol
Copyright (C) Andrew Tridgell 1998
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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "smbdes.h"
/* NOTES:
This code makes no attempt to be fast! In fact, it is a very
slow implementation
This code is NOT a complete DES implementation. It implements only
the minimum necessary for SMB authentication, as used by all SMB
products (including every copy of Microsoft Windows95 ever sold)
In particular, it can only do a unchained forward DES pass. This
means it is not possible to use this code for encryption/decryption
of data, instead it is only useful as a "hash" algorithm.
There is no entry point into this code that allows normal DES operation.
I believe this means that this code does not come under ITAR
regulations but this is NOT a legal opinion. If you are concerned
about the applicability of ITAR regulations to this code then you
should confirm it for yourself (and maybe let me know if you come
up with a different answer to the one above)
*/
#define uchar unsigned char
static uchar perm1[56] = {57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4};
static uchar perm2[48] = {14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32};
static uchar perm3[64] = {58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7};
static uchar perm4[48] = { 32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1};
static uchar perm5[32] = { 16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25};
static uchar perm6[64] ={ 40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25};
static uchar sc[16] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1};
static uchar sbox[8][4][16] = {
{{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7},
{0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8},
{4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0},
{15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}},
{{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10},
{3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5},
{0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15},
{13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}},
{{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8},
{13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1},
{13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7},
{1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}},
{{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15},
{13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9},
{10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4},
{3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}},
{{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9},
{14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6},
{4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14},
{11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}},
{{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11},
{10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8},
{9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6},
{4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}},
{{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1},
{13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6},
{1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2},
{6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}},
{{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7},
{1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2},
{7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8},
{2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}}};
static void permute(char *out, char *in, uchar *p, int n)
{
int i;
for (i=0;i<n;i++)
out[i] = in[p[i]-1];
}
static void lshift(char *d, int count, int n)
{
char out[64];
int i;
for (i=0;i<n;i++)
out[i] = d[(i+count)%n];
for (i=0;i<n;i++)
d[i] = out[i];
}
static void concat(char *out, char *in1, char *in2, int l1, int l2)
{
while (l1--)
*out++ = *in1++;
while (l2--)
*out++ = *in2++;
}
static void xor(char *out, char *in1, char *in2, int n)
{
int i;
for (i=0;i<n;i++)
out[i] = in1[i] ^ in2[i];
}
static void dohash(char *out, char *in, char *key, int forw)
{
int i, j, k;
char pk1[56];
char c[28];
char d[28];
char cd[56];
char ki[16][48];
char pd1[64];
char l[32], r[32];
char rl[64];
permute(pk1, key, perm1, 56);
for (i=0;i<28;i++)
c[i] = pk1[i];
for (i=0;i<28;i++)
d[i] = pk1[i+28];
for (i=0;i<16;i++) {
lshift(c, sc[i], 28);
lshift(d, sc[i], 28);
concat(cd, c, d, 28, 28);
permute(ki[i], cd, perm2, 48);
}
permute(pd1, in, perm3, 64);
for (j=0;j<32;j++) {
l[j] = pd1[j];
r[j] = pd1[j+32];
}
for (i=0;i<16;i++) {
char er[48];
char erk[48];
char b[8][6];
char cb[32];
char pcb[32];
char r2[32];
permute(er, r, perm4, 48);
xor(erk, er, ki[forw ? i : 15 - i], 48);
for (j=0;j<8;j++)
for (k=0;k<6;k++)
b[j][k] = erk[j*6 + k];
for (j=0;j<8;j++) {
int m, n;
m = (b[j][0]<<1) | b[j][5];
n = (b[j][1]<<3) | (b[j][2]<<2) | (b[j][3]<<1) | b[j][4];
for (k=0;k<4;k++)
b[j][k] = (sbox[j][m][n] & (1<<(3-k)))?1:0;
}
for (j=0;j<8;j++)
for (k=0;k<4;k++)
cb[j*4+k] = b[j][k];
permute(pcb, cb, perm5, 32);
xor(r2, l, pcb, 32);
for (j=0;j<32;j++)
l[j] = r[j];
for (j=0;j<32;j++)
r[j] = r2[j];
}
concat(rl, r, l, 32, 32);
permute(out, rl, perm6, 64);
}
static void str_to_key(unsigned char *str,unsigned char *key)
{
int i;
key[0] = str[0]>>1;
key[1] = ((str[0]&0x01)<<6) | (str[1]>>2);
key[2] = ((str[1]&0x03)<<5) | (str[2]>>3);
key[3] = ((str[2]&0x07)<<4) | (str[3]>>4);
key[4] = ((str[3]&0x0F)<<3) | (str[4]>>5);
key[5] = ((str[4]&0x1F)<<2) | (str[5]>>6);
key[6] = ((str[5]&0x3F)<<1) | (str[6]>>7);
key[7] = str[6]&0x7F;
for (i=0;i<8;i++) {
key[i] = (key[i]<<1);
}
}
static void smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
{
int i;
char outb[64];
char inb[64];
char keyb[64];
unsigned char key2[8];
str_to_key(key, key2);
for (i=0;i<64;i++) {
inb[i] = (in[i/8] & (1<<(7-(i%8)))) ? 1 : 0;
keyb[i] = (key2[i/8] & (1<<(7-(i%8)))) ? 1 : 0;
outb[i] = 0;
}
dohash(outb, inb, keyb, forw);
for (i=0;i<8;i++) {
out[i] = 0;
}
for (i=0;i<64;i++) {
if (outb[i])
out[i/8] |= (1<<(7-(i%8)));
}
}
void E_P16(unsigned char *p14,unsigned char *p16)
{
unsigned char sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
smbhash(p16, sp8, p14, 1);
smbhash(p16+8, sp8, p14+7, 1);
}
void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24)
{
smbhash(p24, c8, p21, 1);
smbhash(p24+8, c8, p21+7, 1);
smbhash(p24+16, c8, p21+14, 1);
}
void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out)
{
smbhash(out, in, p14, 0);
smbhash(out+8, in+8, p14+7, 0);
}
void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out)
{
smbhash(out, in, p14, 1);
smbhash(out+8, in+8, p14+7, 1);
}
void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key)
{
unsigned char buf[8];
smbhash(buf, in, key, 1);
smbhash(out, buf, key+9, 1);
}
void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key)
{
unsigned char buf[8];
static unsigned char key2[8];
smbhash(buf, in, key, 1);
key2[0] = key[7];
smbhash(out, buf, key2, 1);
}
void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int forw)
{
static unsigned char key2[8];
smbhash(out, in, key, forw);
key2[0] = key[7];
smbhash(out + 8, in + 8, key2, forw);
}
void SamOEMhash( unsigned char *data, unsigned char *key, int val)
{
unsigned char s_box[256];
unsigned char index_i = 0;
unsigned char index_j = 0;
unsigned char j = 0;
int ind;
for (ind = 0; ind < 256; ind++)
{
s_box[ind] = (unsigned char)ind;
}
for( ind = 0; ind < 256; ind++)
{
unsigned char tc;
j += (s_box[ind] + key[ind%16]);
tc = s_box[ind];
s_box[ind] = s_box[j];
s_box[j] = tc;
}
for( ind = 0; ind < (val ? 516 : 16); ind++)
{
unsigned char tc;
unsigned char t;
index_i++;
index_j += s_box[index_i];
tc = s_box[index_i];
s_box[index_i] = s_box[index_j];
s_box[index_j] = tc;
t = s_box[index_i] + s_box[index_j];
data[ind] = data[ind] ^ s_box[t];
}
}

View File

@ -1,9 +0,0 @@
extern void E_P16(unsigned char *p14,unsigned char *p16);
extern void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
extern void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
extern void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out);
extern void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key);
extern void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key);
extern void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int forw);
extern void SamOEMhash( unsigned char *data, unsigned char *key, int val);

View File

@ -1,325 +0,0 @@
/*
Unix SMB/Netbios implementation.
Version 1.9.
SMB parameters and setup
Copyright (C) Andrew Tridgell 1992-1998
Modified by Jeremy Allison 1995.
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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define DEBUG(a,b) ;
extern int DEBUGLEVEL;
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "smbbyteorder.h"
#include "smbdes.h"
#include "smbmd4.h"
#ifndef _AIX
typedef unsigned char uchar;
#endif
typedef signed short int16;
typedef unsigned short uint16;
typedef int BOOL;
#define False 0
#define True 1
/****************************************************************************
Like strncpy but always null terminates. Make sure there is room!
The variable n should always be one less than the available size.
****************************************************************************/
char *StrnCpy(char *dest,const char *src, size_t n)
{
char *d = dest;
if (!dest) return(NULL);
if (!src) {
*dest = 0;
return(dest);
}
while (n-- && (*d++ = *src++)) ;
*d = 0;
return(dest);
}
size_t skip_multibyte_char(char c)
{
return 0;
}
/*******************************************************************
safe string copy into a known length string. maxlength does not
include the terminating zero.
********************************************************************/
char *safe_strcpy(char *dest,const char *src, size_t maxlength)
{
size_t len;
if (!dest) {
DEBUG(0,("ERROR: NULL dest in safe_strcpy\n"));
return NULL;
}
if (!src) {
*dest = 0;
return dest;
}
len = strlen(src);
if (len > maxlength) {
DEBUG(0,("ERROR: string overflow by %d in safe_strcpy [%.50s]\n",
(int)(len-maxlength), src));
len = maxlength;
}
memcpy(dest, src, len);
dest[len] = 0;
return dest;
}
void strupper(char *s)
{
while (*s)
{
{
size_t skip = skip_multibyte_char( *s );
if( skip != 0 )
s += skip;
else
{
if (islower((unsigned char)*s))
*s = toupper((unsigned char)*s);
s++;
}
}
}
}
extern void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]);
/*
This implements the X/Open SMB password encryption
It takes a password, a 8 byte "crypt key" and puts 24 bytes of
encrypted password into p24
*/
void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24)
{
uchar p14[15], p21[21];
memset(p21,'\0',21);
memset(p14,'\0',14);
StrnCpy((char *)p14,(char *)passwd,14);
strupper((char *)p14);
E_P16(p14, p21);
SMBOWFencrypt(p21, c8, p24);
#ifdef DEBUG_PASSWORD
DEBUG(100,("SMBencrypt: lm#, challenge, response\n"));
dump_data(100, (char *)p21, 16);
dump_data(100, (char *)c8, 8);
dump_data(100, (char *)p24, 24);
#endif
}
/* Routines for Windows NT MD4 Hash functions. */
static int _my_wcslen(int16 *str)
{
int len = 0;
while(*str++ != 0)
len++;
return len;
}
/*
* Convert a string into an NT UNICODE string.
* Note that regardless of processor type
* this must be in intel (little-endian)
* format.
*/
static int _my_mbstowcs(int16 *dst, uchar *src, int len)
{
int i;
int16 val;
for(i = 0; i < len; i++) {
val = *src;
SSVAL(dst,0,val);
dst++;
src++;
if(val == 0)
break;
}
return i;
}
/*
* Creates the MD4 Hash of the users password in NT UNICODE.
*/
void E_md4hash(uchar *passwd, uchar *p16)
{
int len;
int16 wpwd[129];
/* Password cannot be longer than 128 characters */
len = strlen((char *)passwd);
if(len > 128)
len = 128;
/* Password must be converted to NT unicode */
_my_mbstowcs(wpwd, passwd, len);
wpwd[len] = 0; /* Ensure string is null terminated */
/* Calculate length in bytes */
len = _my_wcslen(wpwd) * sizeof(int16);
mdfour(p16, (unsigned char *)wpwd, len);
}
/* Does both the NT and LM owfs of a user's password */
void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16])
{
char passwd[130];
memset(passwd,'\0',130);
safe_strcpy( passwd, pwd, sizeof(passwd)-1);
/* Calculate the MD4 hash (NT compatible) of the password */
memset(nt_p16, '\0', 16);
E_md4hash((uchar *)passwd, nt_p16);
#ifdef DEBUG_PASSWORD
DEBUG(100,("nt_lm_owf_gen: pwd, nt#\n"));
dump_data(120, passwd, strlen(passwd));
dump_data(100, (char *)nt_p16, 16);
#endif
/* Mangle the passwords into Lanman format */
passwd[14] = '\0';
strupper(passwd);
/* Calculate the SMB (lanman) hash functions of the password */
memset(p16, '\0', 16);
E_P16((uchar *) passwd, (uchar *)p16);
#ifdef DEBUG_PASSWORD
DEBUG(100,("nt_lm_owf_gen: pwd, lm#\n"));
dump_data(120, passwd, strlen(passwd));
dump_data(100, (char *)p16, 16);
#endif
/* clear out local copy of user's password (just being paranoid). */
memset(passwd, '\0', sizeof(passwd));
}
/* Does the des encryption from the NT or LM MD4 hash. */
void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24])
{
uchar p21[21];
memset(p21,'\0',21);
memcpy(p21, passwd, 16);
E_P24(p21, c8, p24);
}
/* Does the des encryption from the FIRST 8 BYTES of the NT or LM MD4 hash. */
void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24])
{
uchar p21[21];
memset(p21,'\0',21);
memcpy(p21, passwd, 8);
memset(p21 + 8, 0xbd, 8);
E_P24(p21, ntlmchalresp, p24);
#ifdef DEBUG_PASSWORD
DEBUG(100,("NTLMSSPOWFencrypt: p21, c8, p24\n"));
dump_data(100, (char *)p21, 21);
dump_data(100, (char *)ntlmchalresp, 8);
dump_data(100, (char *)p24, 24);
#endif
}
/* Does the NT MD4 hash then des encryption. */
void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24)
{
uchar p21[21];
memset(p21,'\0',21);
E_md4hash(passwd, p21);
SMBOWFencrypt(p21, c8, p24);
#ifdef DEBUG_PASSWORD
DEBUG(100,("SMBNTencrypt: nt#, challenge, response\n"));
dump_data(100, (char *)p21, 16);
dump_data(100, (char *)c8, 8);
dump_data(100, (char *)p24, 24);
#endif
}
#if 0
BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode)
{
int new_pw_len = strlen(passwd) * (unicode ? 2 : 1);
if (new_pw_len > 512)
{
DEBUG(0,("make_oem_passwd_hash: new password is too long.\n"));
return False;
}
/*
* Now setup the data area.
* We need to generate a random fill
* for this area to make it harder to
* decrypt. JRA.
*/
generate_random_buffer((unsigned char *)data, 516, False);
if (unicode)
{
struni2( &data[512 - new_pw_len], passwd);
}
else
{
fstrcpy( &data[512 - new_pw_len], passwd);
}
SIVAL(data, 512, new_pw_len);
#ifdef DEBUG_PASSWORD
DEBUG(100,("make_oem_passwd_hash\n"));
dump_data(100, data, 516);
#endif
SamOEMhash( (unsigned char *)data, (unsigned char *)old_pw_hash, True);
return True;
}
#endif

View File

@ -1,2 +0,0 @@
void SMBencrypt(char *passwd, uint8 *c8, uint8 *p24);
void SMBNTencrypt(char *passwd, uint8 *c8, uint8 *p24);

View File

@ -1,173 +0,0 @@
/*
Unix SMB/Netbios implementation.
Version 1.9.
a implementation of MD4 designed for use in the SMB authentication protocol
Copyright (C) Andrew Tridgell 1997-1998.
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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string.h>
#include "smbmd4.h"
typedef unsigned uint32;
/* NOTE: This code makes no attempt to be fast!
It assumes that a int is at least 32 bits long
*/
static uint32 A, B, C, D;
static uint32 F(uint32 X, uint32 Y, uint32 Z)
{
return (X&Y) | ((~X)&Z);
}
static uint32 G(uint32 X, uint32 Y, uint32 Z)
{
return (X&Y) | (X&Z) | (Y&Z);
}
static uint32 H(uint32 X, uint32 Y, uint32 Z)
{
return X^Y^Z;
}
static uint32 lshift(uint32 x, int s)
{
x &= 0xFFFFFFFF;
return ((x<<s)&0xFFFFFFFF) | (x>>(32-s));
}
#define ROUND1(a,b,c,d,k,s) a = lshift(a + F(b,c,d) + X[k], s)
#define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + (uint32)0x5A827999,s)
#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s)
/* this applies md4 to 64 byte chunks */
static void mdfour64(uint32 *M)
{
int j;
uint32 AA, BB, CC, DD;
uint32 X[16];
for (j=0;j<16;j++)
X[j] = M[j];
AA = A; BB = B; CC = C; DD = D;
ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7);
ROUND1(C,D,A,B, 2, 11); ROUND1(B,C,D,A, 3, 19);
ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7);
ROUND1(C,D,A,B, 6, 11); ROUND1(B,C,D,A, 7, 19);
ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7);
ROUND1(C,D,A,B, 10, 11); ROUND1(B,C,D,A, 11, 19);
ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7);
ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19);
ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5);
ROUND2(C,D,A,B, 8, 9); ROUND2(B,C,D,A, 12, 13);
ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5);
ROUND2(C,D,A,B, 9, 9); ROUND2(B,C,D,A, 13, 13);
ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5);
ROUND2(C,D,A,B, 10, 9); ROUND2(B,C,D,A, 14, 13);
ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5);
ROUND2(C,D,A,B, 11, 9); ROUND2(B,C,D,A, 15, 13);
ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9);
ROUND3(C,D,A,B, 4, 11); ROUND3(B,C,D,A, 12, 15);
ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9);
ROUND3(C,D,A,B, 6, 11); ROUND3(B,C,D,A, 14, 15);
ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9);
ROUND3(C,D,A,B, 5, 11); ROUND3(B,C,D,A, 13, 15);
ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9);
ROUND3(C,D,A,B, 7, 11); ROUND3(B,C,D,A, 15, 15);
A += AA; B += BB; C += CC; D += DD;
A &= 0xFFFFFFFF; B &= 0xFFFFFFFF;
C &= 0xFFFFFFFF; D &= 0xFFFFFFFF;
for (j=0;j<16;j++)
X[j] = 0;
}
static void copy64(uint32 *M, unsigned char *in)
{
int i;
for (i=0;i<16;i++)
M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) |
(in[i*4+1]<<8) | (in[i*4+0]<<0);
}
static void copy4(unsigned char *out,uint32 x)
{
out[0] = x&0xFF;
out[1] = (x>>8)&0xFF;
out[2] = (x>>16)&0xFF;
out[3] = (x>>24)&0xFF;
}
/* produce a md4 message digest from data of length n bytes */
void mdfour(unsigned char *out, unsigned char *in, int n)
{
unsigned char buf[128];
uint32 M[16];
uint32 b = n * 8;
int i;
A = 0x67452301;
B = 0xefcdab89;
C = 0x98badcfe;
D = 0x10325476;
while (n > 64) {
copy64(M, in);
mdfour64(M);
in += 64;
n -= 64;
}
for (i=0;i<128;i++)
buf[i] = 0;
memcpy(buf, in, n);
buf[n] = 0x80;
if (n <= 55) {
copy4(buf+56, b);
copy64(M, buf);
mdfour64(M);
} else {
copy4(buf+120, b);
copy64(M, buf);
mdfour64(M);
copy64(M, buf+64);
mdfour64(M);
}
for (i=0;i<128;i++)
buf[i] = 0;
copy64(M, buf);
copy4(out, A);
copy4(out+4, B);
copy4(out+8, C);
copy4(out+12, D);
A = B = C = D = 0;
}

View File

@ -1 +0,0 @@
extern void mdfour(unsigned char *out, unsigned char *in, int n);

View File

@ -1,235 +0,0 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <string.h>
#include "ntlm.h"
#include "smbencrypt.h"
#include "smbbyteorder.h"
char versionString[] ="libntlm version 0.21";
/* Utility routines that handle NTLM auth structures. */
/* The [IS]VAL macros are to take care of byte order for non-Intel
* Machines -- I think this file is OK, but it hasn't been tested.
* The other files (the ones stolen from Samba) should be OK.
*/
/* I am not crazy about these macros -- they seem to have gotten
* a bit complex. A new scheme for handling string/buffer fields
* in the structures probably needs to be designed
*/
#define AddBytes(ptr, header, buf, count) \
{ \
if (buf && count) \
{ \
SSVAL(&ptr->header.len,0,count); \
SSVAL(&ptr->header.maxlen,0,count); \
SIVAL(&ptr->header.offset,0,((ptr->buffer - ((uint8*)ptr)) + ptr->bufIndex)); \
memcpy(ptr->buffer+ptr->bufIndex, buf, count); \
ptr->bufIndex += count; \
} \
else \
{ \
ptr->header.len = \
ptr->header.maxlen = 0; \
SIVAL(&ptr->header.offset,0,ptr->bufIndex); \
} \
}
#define AddString(ptr, header, string) \
{ \
char *p = string; \
int len = 0; \
if (p) len = strlen(p); \
AddBytes(ptr, header, ((unsigned char*)p), len); \
}
#define AddUnicodeString(ptr, header, string) \
{ \
char *p = string; \
unsigned char *b = NULL; \
int len = 0; \
if (p) \
{ \
len = strlen(p); \
b = strToUnicode(p); \
} \
AddBytes(ptr, header, b, len*2); \
}
#define GetUnicodeString(structPtr, header) \
unicodeToString(((char*)structPtr) + IVAL(&structPtr->header.offset,0) , SVAL(&structPtr->header.len,0)/2)
#define GetString(structPtr, header) \
toString((((char *)structPtr) + IVAL(&structPtr->header.offset,0)), SVAL(&structPtr->header.len,0))
#define DumpBuffer(fp, structPtr, header) \
dumpRaw(fp,((unsigned char*)structPtr)+IVAL(&structPtr->header.offset,0),SVAL(&structPtr->header.len,0))
static void dumpRaw(FILE *fp, unsigned char *buf, size_t len)
{
int i;
for (i=0; i<len; ++i)
fprintf(fp,"%02x ",buf[i]);
fprintf(fp,"\n");
}
static char *unicodeToString(char *p, size_t len)
{
int i;
static char buf[1024];
assert(len+1 < sizeof buf);
for (i=0; i<len; ++i)
{
buf[i] = *p & 0x7f;
p += 2;
}
buf[i] = '\0';
return buf;
}
static unsigned char *strToUnicode(char *p)
{
static unsigned char buf[1024];
size_t l = strlen(p);
int i = 0;
assert(l*2 < sizeof buf);
while (l--)
{
buf[i++] = *p++;
buf[i++] = 0;
}
return buf;
}
static unsigned char *toString(char *p, size_t len)
{
static unsigned char buf[1024];
assert(len+1 < sizeof buf);
memcpy(buf,p,len);
buf[len] = 0;
return buf;
}
void dumpSmbNtlmAuthRequest(FILE *fp, tSmbNtlmAuthRequest *request)
{
fprintf(fp,"NTLM Request:\n");
fprintf(fp," Ident = %s\n",request->ident);
fprintf(fp," mType = %d\n",IVAL(&request->msgType,0));
fprintf(fp," Flags = %08x\n",IVAL(&request->flags,0));
fprintf(fp," User = %s\n",GetString(request,user));
fprintf(fp," Domain = %s\n",GetString(request,domain));
}
void dumpSmbNtlmAuthChallenge(FILE *fp, tSmbNtlmAuthChallenge *challenge)
{
fprintf(fp,"NTLM Challenge:\n");
fprintf(fp," Ident = %s\n",challenge->ident);
fprintf(fp," mType = %d\n",IVAL(&challenge->msgType,0));
fprintf(fp," Domain = %s\n",GetUnicodeString(challenge,uDomain));
fprintf(fp," Flags = %08x\n",IVAL(&challenge->flags,0));
fprintf(fp," Challenge = "); dumpRaw(fp, challenge->challengeData,8);
}
void dumpSmbNtlmAuthResponse(FILE *fp, tSmbNtlmAuthResponse *response)
{
fprintf(fp,"NTLM Response:\n");
fprintf(fp," Ident = %s\n",response->ident);
fprintf(fp," mType = %d\n",IVAL(&response->msgType,0));
fprintf(fp," LmResp = "); DumpBuffer(fp,response,lmResponse);
fprintf(fp," NTResp = "); DumpBuffer(fp,response,ntResponse);
fprintf(fp," Domain = %s\n",GetUnicodeString(response,uDomain));
fprintf(fp," User = %s\n",GetUnicodeString(response,uUser));
fprintf(fp," Wks = %s\n",GetUnicodeString(response,uWks));
fprintf(fp," sKey = "); DumpBuffer(fp, response,sessionKey);
fprintf(fp," Flags = %08x\n",IVAL(&response->flags,0));
}
void buildSmbNtlmAuthRequest(tSmbNtlmAuthRequest *request, char *user, char *domain)
{
char *u;
char *p;
if ((u = strdup(user)) == NULL)
return;
p = strchr(u,'@');
if (p)
{
if (!domain)
domain = p+1;
*p = '\0';
}
request->bufIndex = 0;
memcpy(request->ident,"NTLMSSP\0\0\0",8);
SIVAL(&request->msgType,0,1);
SIVAL(&request->flags,0,0x0000b207); /* have to figure out what these mean */
AddString(request,user,u);
AddString(request,domain,domain);
free(u);
}
void buildSmbNtlmAuthResponse(tSmbNtlmAuthChallenge *challenge, tSmbNtlmAuthResponse *response, char *user, char *password)
{
uint8 lmRespData[24];
uint8 ntRespData[24];
uint8 *up;
char *d;
char *domain;
char *u;
char *p;
if ((d = strdup(GetUnicodeString(challenge,uDomain))) == NULL)
return;
domain = d;
if ((u = strdup(user)) == NULL)
{
free(d);
return;
}
p = strchr(u,'@');
if (p)
{
domain = p+1;
*p = '\0';
}
SMBencrypt(password, challenge->challengeData, lmRespData);
SMBNTencrypt(password, challenge->challengeData, ntRespData);
response->bufIndex = 0;
memcpy(response->ident,"NTLMSSP\0\0\0",8);
SIVAL(&response->msgType,0,3);
up = lmRespData;
AddBytes(response,lmResponse, up, 24);
up = ntRespData;
AddBytes(response,ntResponse, up, 24);
AddUnicodeString(response,uDomain,domain);
AddUnicodeString(response,uUser,u);
AddUnicodeString(response,uWks,u);
AddString(response,sessionKey,NULL);
response->flags = challenge->flags;
free(d);
free(u);
}

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -21,6 +21,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#if !(defined(__FreeBSD__) && __FreeBSD_version < 410000) && \

View File

@ -20,6 +20,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/

View File

@ -19,6 +19,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#ifdef HAVE_KVM_H

View File

@ -19,6 +19,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include <kvm.h>

View File

@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include <glibtop.h>

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,7 +17,21 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include <limits.h>
#include <errno.h>
#include <locale.h>
@ -2217,8 +2231,10 @@ gkrellm_sys_battery_read_data(void)
gboolean
gkrellm_sys_battery_init()
{
/* Prefer sysfs power data to /proc/acpi (which is deprecated). */
if (!sysfs_power_setup ())
/* Prefer sysfs power data to /proc/acpi (which is deprecated).
| But temporarily allow command line override in case transition trouble
*/
if (_GK.use_acpi_battery || !sysfs_power_setup ())
acpi_setup();
return TRUE;
}

View File

@ -20,6 +20,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include <kvm.h>

View File

@ -19,6 +19,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include <kvm.h>

View File

@ -17,8 +17,22 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
/* A system dependent interface can include this file to get sensors
| from daemons that can run under different operating systems.
*/

View File

@ -19,6 +19,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include <kstat.h>

View File

@ -20,6 +20,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "../inet.h" // For struct ActiveTCP

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,9 +17,21 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "win32-plugin.h"
win32_plugin_callbacks gkrellm_callbacks;

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"

View File

@ -1,5 +1,5 @@
/* GKrellM
| Copyright (C) 1999-2007 Bill Wilson
| Copyright (C) 1999-2008 Bill Wilson
|
| Author: Bill Wilson billw@gkrellm.net
| Latest versions might be found at: http://gkrellm.net
@ -17,6 +17,18 @@
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see http://www.gnu.org/licenses/
|
|
| Additional permission under GNU GPL version 3 section 7
|
| If you modify this program, or any covered work, by linking or
| combining it with the OpenSSL project's OpenSSL library (or a
| modified version of that library), containing parts covered by
| the terms of the OpenSSL or SSLeay licenses, you are granted
| additional permission to convey the resulting work.
| Corresponding Source for a non-source form of such a combination
| shall include the source code for the parts of OpenSSL used as well
| as that of the covered work.
*/
#include "gkrellm.h"