openlanhouse-development Mailing List for OpenLanhouse
Status: Pre-Alpha
Brought to you by:
n3rd3x
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(5) |
Oct
(32) |
Nov
|
Dec
|
|---|
|
From: <n3...@us...> - 2008-10-29 15:10:25
|
Revision: 317
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=317&view=rev
Author: n3rd3x
Date: 2008-10-29 15:10:22 +0000 (Wed, 29 Oct 2008)
Log Message:
-----------
last svn commit\!, this repository is migrated to git, you can get a new repository with command: git clone git://git.openlanhouse.org/openlanhouse.git
Added Paths:
-----------
trunk/README
Added: trunk/README
===================================================================
--- trunk/README (rev 0)
+++ trunk/README 2008-10-29 15:10:22 UTC (rev 317)
@@ -0,0 +1,3 @@
+* Repository is migrated to git. is available using this command:
+ git clone git://git.openlanhouse.org/openlanhouse.git
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-28 20:55:13
|
Revision: 316
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=316&view=rev
Author: n3rd3x
Date: 2008-10-28 20:55:06 +0000 (Tue, 28 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/openlh-core/src/OpenlhCore/utils.py
trunk/openlh-server/data/glade/prefs.glade
trunk/openlh-server/data/openlh-server.schemas.in
Modified: trunk/openlh-core/src/OpenlhCore/utils.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/utils.py 2008-10-28 16:33:56 UTC (rev 315)
+++ trunk/openlh-core/src/OpenlhCore/utils.py 2008-10-28 20:55:06 UTC (rev 316)
@@ -30,7 +30,7 @@
dl = None
import base64
-from md5 import md5
+from hashlib import md5
import threading
import time
import traceback
Modified: trunk/openlh-server/data/glade/prefs.glade
===================================================================
--- trunk/openlh-server/data/glade/prefs.glade 2008-10-28 16:33:56 UTC (rev 315)
+++ trunk/openlh-server/data/glade/prefs.glade 2008-10-28 20:55:06 UTC (rev 316)
@@ -1,7 +1,6 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Wed Aug 6 12:14:38 2008 -->
+<?xml version="1.0"?>
<glade-interface>
+ <requires-version lib="gtk+" version="2.12"/>
<widget class="GtkDialog" id="prefs">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">6</property>
@@ -36,46 +35,62 @@
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
- <widget class="GtkLabel" id="label6">
+ <widget class="GtkEntry" id="currency">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Name:</property>
- <property name="use_markup">True</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">lan_name</property>
+ <signal name="focus_out_event" handler="on_currency_focus_out_event"/>
</widget>
<packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="lan_name">
+ <widget class="GtkSpinButton" id="price_hour">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="tooltip" translatable="yes">name for lanhouse network</property>
- <signal name="focus_out_event" handler="lan_name_changed"/>
+ <property name="adjustment">0 0 100 0.01 10 10</property>
+ <property name="digits">2</property>
+ <signal name="focus_out_event" handler="on_price_hour_focus_out_event"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label7">
+ <widget class="GtkEntry" id="admin_email">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <signal name="focus_out_event" handler="admin_email_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Price hour:</property>
+ <property name="label" translatable="yes">_Administrator email:</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">price_hour</property>
+ <property name="mnemonic_widget">admin_email</property>
</widget>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@@ -98,66 +113,50 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label1">
+ <widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Administrator email:</property>
+ <property name="label" translatable="yes">_Price hour:</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">admin_email</property>
+ <property name="mnemonic_widget">price_hour</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="admin_email">
+ <widget class="GtkEntry" id="lan_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal name="focus_out_event" handler="admin_email_changed"/>
+ <property name="tooltip" translatable="yes">name for lanhouse network</property>
+ <signal name="focus_out_event" handler="lan_name_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
</packing>
</child>
<child>
- <widget class="GtkSpinButton" id="price_hour">
+ <widget class="GtkLabel" id="label6">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="adjustment">0 0 100 0.01 10 10</property>
- <property name="digits">2</property>
- <signal name="focus_out_event" handler="on_price_hour_focus_out_event"/>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Name:</property>
+ <property name="use_markup">True</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">lan_name</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
- <child>
- <widget class="GtkEntry" id="currency">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal name="focus_out_event" handler="on_currency_focus_out_event"/>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -175,8 +174,8 @@
<property name="use_underline">True</property>
</widget>
<packing>
+ <property name="tab_fill">False</property>
<property name="type">tab</property>
- <property name="tab_fill">False</property>
</packing>
</child>
<child>
@@ -224,6 +223,7 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Login support</property>
<property name="use_underline">True</property>
+ <property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_machine_login_suport_toggled"/>
</widget>
@@ -235,6 +235,7 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Ticket support</property>
<property name="use_underline">True</property>
+ <property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_ticket_suport_toggled"/>
</widget>
@@ -288,32 +289,34 @@
<placeholder/>
</child>
<child>
- <widget class="GtkCheckButton" id="background_bnt">
+ <widget class="GtkCheckButton" id="logo_bnt">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Background:</property>
+ <property name="label" translatable="yes">_Logo:</property>
<property name="use_underline">True</property>
+ <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="background_bnt_toggled_cb"/>
+ <signal name="toggled" handler="on_logo_bnt_toggled"/>
</widget>
<packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="logo_bnt">
+ <widget class="GtkCheckButton" id="background_bnt">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Logo:</property>
+ <property name="label" translatable="yes">_Background:</property>
<property name="use_underline">True</property>
+ <property name="response_id">0</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_logo_bnt_toggled"/>
+ <signal name="toggled" handler="background_bnt_toggled_cb"/>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
@@ -361,37 +364,31 @@
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
- <widget class="GtkRadioButton" id="default_welcome_msg">
+ <widget class="GtkLabel" id="">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Default: "Welcome"</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="custom_welcome_msg">
+ <widget class="GtkLabel" id="label21">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">C_ustom:</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><small><i>%n will be replaced by hostname</i></small></property>
+ <property name="use_markup">True</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">default_welcome_msg</property>
- <signal name="toggled" handler="on_custom_welcome_msg_toggled"/>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
@@ -412,31 +409,39 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label21">
+ <widget class="GtkRadioButton" id="custom_welcome_msg">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><small><i>%n will be replaced by hostname</i></small></property>
- <property name="use_markup">True</property>
+ <property name="label" translatable="yes">C_ustom:</property>
<property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">default_welcome_msg</property>
+ <signal name="toggled" handler="on_custom_welcome_msg_toggled"/>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="">
+ <widget class="GtkRadioButton" id="default_welcome_msg">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">_Default: "Welcome"</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options"></property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
@@ -472,11 +477,58 @@
<property name="use_underline">True</property>
</widget>
<packing>
- <property name="type">tab</property>
<property name="position">1</property>
<property name="tab_fill">False</property>
+ <property name="type">tab</property>
</packing>
</child>
+ <child>
+ <widget class="GtkVBox" id="vbox8">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="spacing">18</property>
+ <child>
+ <widget class="GtkVBox" id="vbox9">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Session Finishing</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Actions</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">1</property>
Modified: trunk/openlh-server/data/openlh-server.schemas.in
===================================================================
--- trunk/openlh-server/data/openlh-server.schemas.in 2008-10-28 16:33:56 UTC (rev 315)
+++ trunk/openlh-server/data/openlh-server.schemas.in 2008-10-28 20:55:06 UTC (rev 316)
@@ -493,4 +493,32 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/openlh-server/close_apps</key>
+ <applyto>/apps/openlh-server/close_apps</applyto>
+ <owner>openlh-server</owner>
+ <type>bool</type>
+ <default>false</default>
+
+ <locale name="C">
+ <short>If true, applications will closed after finishing the session</short>
+ <long>If true, applications will closed after finishing the session.</long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/openlh-server/close_apps_list</key>
+ <applyto>/apps/openlh-server/close_apps_list</applyto>
+ <owner>openlh-server</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+
+ <locale name="C">
+ <short>Applications to be closed after finishing the session</short>
+ <long>Applications to be closed after finishing the session.</long>
+ </locale>
+ </schema>
+
+
+
</schemalist></gconfschemafile>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-20 15:50:08
|
Revision: 313
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=313&view=rev
Author: n3rd3x
Date: 2008-10-20 15:50:00 +0000 (Mon, 20 Oct 2008)
Log Message:
-----------
openlh-client/src/OpenlhClient/certgen.py: This file is removed
Modified Paths:
--------------
trunk/openlh-client/src/OpenlhClient/Makefile.am
trunk/openlh-client/src/OpenlhClient/__init__.py
Removed Paths:
-------------
trunk/openlh-client/src/OpenlhClient/certgen.py
trunk/openlh-client/src/OpenlhClient/server_info.py
trunk/openlh-client/src/OpenlhClient/xmlpickler.py
Modified: trunk/openlh-client/src/OpenlhClient/Makefile.am
===================================================================
--- trunk/openlh-client/src/OpenlhClient/Makefile.am 2008-10-20 15:46:50 UTC (rev 312)
+++ trunk/openlh-client/src/OpenlhClient/Makefile.am 2008-10-20 15:50:00 UTC (rev 313)
@@ -3,13 +3,10 @@
openlhdir = $(pythondir)/OpenlhClient
openlh_PYTHON = \
__init__.py \
- certgen.py \
login.py \
globals.py \
main.py \
utils.py \
- xmlpickler.py \
config.py \
prefs.py \
- dbus_manager.py \
- server_info.py
+ dbus_manager.py
Modified: trunk/openlh-client/src/OpenlhClient/__init__.py
===================================================================
--- trunk/openlh-client/src/OpenlhClient/__init__.py 2008-10-20 15:46:50 UTC (rev 312)
+++ trunk/openlh-client/src/OpenlhClient/__init__.py 2008-10-20 15:50:00 UTC (rev 313)
@@ -16,5 +16,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__all__ = ('login', 'server_info', 'ui', 'config'
+__all__ = ('login', 'ui', 'config'
'globals', 'utils', 'main', 'prefs', 'dbus_manager')
Deleted: trunk/openlh-client/src/OpenlhClient/certgen.py
===================================================================
--- trunk/openlh-client/src/OpenlhClient/certgen.py 2008-10-20 15:46:50 UTC (rev 312)
+++ trunk/openlh-client/src/OpenlhClient/certgen.py 2008-10-20 15:50:00 UTC (rev 313)
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2008 Wilson Pinto Júnior (N3RD3X) <n3...@gu...>
-# Copyright (C) 2008 Gabriel Falcão <ga...@na...>
-#
-# 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, see <http://www.gnu.org/licenses/>.
-
-import sys
-import os
-
-TYPE_RSA = 0
-TYPE_DSA = 1
-
-from OpenlhClient.utils import execute_command, is_in_path
-
-CERTTOOL_PATH = is_in_path("certtool")
-
-class CreateTemplateError(Exception): pass
-
-def generate_private_key(type=TYPE_RSA, bits=1024):
-
- print CERTTOOL_PATH
-
- cmd = [CERTTOOL_PATH, "--generate-privkey", "--bits", str(bits)]
-
- if type == TYPE_DSA:
- cmd.append('--dsa')
-
- (stdout, stderr, retval) = execute_command(cmd)
-
- if retval != 0:
- raise SystemError(stderr)
- else:
- return stdout
-
-def generate_self_signed(template_file, privkey_file):
-
- cmd = [CERTTOOL_PATH, "--template", template_file, "--generate-self-signed",
- "--load-privkey", privkey_file]
-
- (stdout, stderr, retval) = execute_command(cmd)
-
- if retval != 0:
- raise IOError(stdout)
- else:
- return stdout
-
-def create_template(organization, common_name, expiration_days, email=None,
- unit=None, locality=None, state=None, country=None):
-
- data = []
- data.append('organization = "%s"' % organization)
-
- if unit:
- data.append('unit = "%s"' % unit)
-
- if locality:
- data.append('locality = "%s"' % locality)
-
- if state:
- data.append('state = "%s"' % state)
-
- if country:
- data.append('country = %s' % country)
-
- data.append('cn = "%s"' % common_name)
- data.append('expiration_days = %d' % expiration_days)
-
- if email:
- data.append('email = "%s"' % email)
-
- return '\n'.join(data)
\ No newline at end of file
Deleted: trunk/openlh-client/src/OpenlhClient/server_info.py
===================================================================
--- trunk/openlh-client/src/OpenlhClient/server_info.py 2008-10-20 15:46:50 UTC (rev 312)
+++ trunk/openlh-client/src/OpenlhClient/server_info.py 2008-10-20 15:50:00 UTC (rev 313)
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2008 Wilson Pinto Júnior (N3RD3X) <n3...@gu...>
-# Copyright (C) 2008 Gabriel Falcão <ga...@na...>
-#
-# 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, see <http://www.gnu.org/licenses/>.
-
-import gtk
-import gtk.glade
-
-from OpenLH.core.globals import *
-
-class ServerInfo:
- def __init__(self):
- self.xml = self.create_widgets(SERVER_INFO_GLADE)
- self.xml.signal_autoconnect(self)
-
- self.set_price = lambda x: self.price.set_text(x)
- self.set_server_os = lambda x: self.server_os.set_text(x)
- self.set_client_os = lambda x: self.client_os.set_text(x)
- self.set_server_host = lambda x: self.server_host.set_text(x)
- self.set_client_host = lambda x: self.client_host.set_text(x)
- self.set_admin_email = lambda x: self.admin_email.set_text(x)
- self.set_server_version = lambda x: self.server_version.set_text(x)
- self.set_client_version = lambda x: self.client_version.set_text(x)
-
- def create_widgets(self, glade_file):
- xml = gtk.glade.XML(glade_file)
-
- self.price = xml.get_widget('price')
- self.lan_name = xml.get_widget('lan_name')
- self.emailbox = xml.get_widget('emailbox')
- self.server_os = xml.get_widget('server_os')
- self.client_os = xml.get_widget('client_os')
- self.server_info = xml.get_widget('server_info')
- self.admin_email = xml.get_widget('admin_email')
- self.server_host = xml.get_widget('server_host')
- self.client_host = xml.get_widget('client_host')
- self.server_version = xml.get_widget('server_version')
- self.client_version = xml.get_widget('client_version')
-
- return xml
-
- def run(self):
- self.server_info.run()
- self.server_info.hide()
\ No newline at end of file
Deleted: trunk/openlh-client/src/OpenlhClient/xmlpickler.py
===================================================================
--- trunk/openlh-client/src/OpenlhClient/xmlpickler.py 2008-10-20 15:46:50 UTC (rev 312)
+++ trunk/openlh-client/src/OpenlhClient/xmlpickler.py 2008-10-20 15:50:00 UTC (rev 313)
@@ -1,833 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2007 Python 2.5 Developers
-# Copyright (C) 2008 Wilson Pinto Júnior (N3RD3X) <n3...@gu...>
-# Copyright (C) 2008 Gabriel Falcão <ga...@na...>
-#
-#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, see <http://www.gnu.org/licenses/>.
-
-#Based in Xmlrpclib
-__version__ = "1.0.1"
-
-#ERRORS
-PARSE_ERROR = -32700
-SERVER_ERROR = -32600
-APPLICATION_ERROR = -32500
-SYSTEM_ERROR = -32400
-TRANSPORT_ERROR = -32300
-NOT_WELLFORMED_ERROR = -32700
-UNSUPPORTED_ENCODING = -32701
-INVALID_ENCODING_CHAR = -32702
-INVALID_XMLRPC = -32600
-METHOD_NOT_FOUND = -32601
-INVALID_METHOD_PARAMS = -32602
-INTERNAL_ERROR = -32603
-
-MAXINT = 2L ** 31 - 1
-MININT = - 2L ** 31
-
-import re
-import string
-import time
-import datetime
-import operator
-import base64
-
-try:
- import cStringIO as StringIO
-except ImportError:
- import StringIO
-
-class DateTime:
- """DateTime wrapper for an ISO 8601 string or time tuple or
- localtime integer value to generate 'dateTime.iso8601'
- """
-
- def __init__(self, value=0):
- if not isinstance(value, StringType):
- if datetime and isinstance(value, datetime.datetime):
- self.value = value.strftime("%Y%m%dT%H:%M:%S")
- return
-
- if datetime and isinstance(value, datetime.date):
- self.value = value.strftime("%Y%m%dT%H:%M:%S")
- return
-
- if datetime and isinstance(value, datetime.time):
- today = datetime.datetime.now().strftime("%Y%m%d")
- self.value = value.strftime(today + "T%H:%M:%S")
- return
-
- if not isinstance(value, (TupleType, time.struct_time)):
- if value == 0:
- value = time.time()
-
- value = time.localtime(value)
-
- value = time.strftime("%Y%m%dT%H:%M:%S", value)
-
- self.value = value
-
- def __cmp__(self, other):
- if isinstance(other, DateTime):
- other = other.value
-
- return cmp(self.value, other)
-
- ##
- # Get date/time value.
- #
- # @return Date/time value, as an ISO 8601 string.
-
- def __str__(self):
- return self.value
-
- def __repr__(self):
- return "<DateTime %s at %x>" % (repr(self.value), id(self))
-
- def decode(self, data):
- data = str(data)
- self.value = string.strip(data)
-
- def encode(self, out):
- out.write("<value><dateTime.iso8601>")
- out.write(self.value)
- out.write("</dateTime.iso8601></value>\n")
-
-class Binary:
- def __init__(self, data=None):
- self.data = data
-
- ##
- # Get buffer contents.
- #
- # @return Buffer contents, as an 8-bit string.
-
- def __str__(self):
- return self.data or ""
-
- def __cmp__(self, other):
- if isinstance(other, Binary):
- other = other.data
- return cmp(self.data, other)
-
- def decode(self, data):
- self.data = base64.decodestring(data)
-
- def encode(self, out):
- out.write("<value><base64>\n")
- base64.encode(StringIO.StringIO(self.data), out)
- out.write("</base64></value>\n")
-
-class _Boolean:
- def __init__(self, value = 0):
- self.value = operator.truth(value)
-
- def encode(self, out):
- out.write("<value><boolean>%d</boolean></value>\n" % self.value)
-
- def __cmp__(self, other):
- if isinstance(other, Boolean):
- other = other.value
- return cmp(self.value, other)
-
- def __repr__(self):
- if self.value:
- return "<Boolean True at %x>" % id(self)
- else:
- return "<Boolean False at %x>" % id(self)
-
- def __int__(self):
- return self.value
-
- def __nonzero__(self):
- return self.value
-
-try:
- unicode
-except:
- unicode = None
-
-try:
- import datetime
-except:
- datetime = None
-
-from types import * #FIX ME
-
-try:
- _bool_is_builtin = False.__class__.__name__ == "bool"
-except NameError:
- _bool_is_builtin = 0
-
-def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search):
- # decode non-ascii string (if possible)
- if unicode and encoding and is8bit(data):
- data = unicode(data, encoding)
- return data
-
-def escape(s, replace=string.replace):
- s = replace(s, "&", "&")
- s = replace(s, "<", "<")
- return replace(s, ">", ">",)
-
-if unicode:
- def _stringify(string):
- try:
- return string.encode("ascii")
- except UnicodeError:
- return string
-else:
- def _stringify(string):
- return string
-
-#EXCEPTIONS
-class Error(Exception):
- """Base class for client errors."""
- def __str__(self):
- return repr(self)
-
-class ResponseError(Error):
- """Indicates a broken response package."""
- pass
-
-class Fault(Error):
- """Indicates an XML-RPC fault package."""
- def __init__(self, faultCode, faultString, **extra):
- Error.__init__(self)
- self.faultCode = faultCode
- self.faultString = faultString
- def __repr__(self):
- return (
- "<Fault %s: %s>" %
- (self.faultCode, repr(self.faultString))
- )
-
-
-if _bool_is_builtin:
- boolean = Boolean = bool
- True, False = True, False
-
-else:
- Boolean = _Boolean
- True, False = Boolean(1), Boolean(0)
-
- def boolean(value, _truefalse=(False, True)):
- """Convert any Python value to XML-RPC 'boolean'."""
- return _truefalse[operator.truth(value)]
-
-def _datetime(data):
- value = DateTime()
- value.decode(data)
- return value
-
-def _datetime_type(data):
- t = time.strptime(data, "%Y%m%dT%H:%M:%S")
- return datetime.datetime(*tuple(t)[:6])
-
-def _binary(data):
- # decode xml element contents into a Binary structure
- value = Binary()
- value.decode(data)
- return value
-
-WRAPPERS = (DateTime, Binary)
-
-if not _bool_is_builtin:
- WRAPPERS = WRAPPERS + (Boolean,)
-
-try:
- # optional xmlrpclib accelerator
- import _xmlrpclib
- FastParser = _xmlrpclib.Parser
- FastUnmarshaller = _xmlrpclib.Unmarshaller
-except (AttributeError, ImportError):
- FastParser = FastUnmarshaller = None
-
-try:
- import _xmlrpclib
- FastMarshaller = _xmlrpclib.Marshaller
-except (AttributeError, ImportError):
- FastMarshaller = None
-
-
-class _SgmlopParser:
- def __init__(self, target):
- # setup callbacks
- self.finish_starttag = target.start
- self.finish_endtag = target.end
- self.handle_data = target.data
- self.handle_xml = target.xml
-
- # activate parser
- self.parser = sgmlop.XMLParser()
- self.parser.register(self)
- self.feed = self.parser.feed
- self.entity = {
- "amp": "&", "gt": ">", "lt": "<",
- "apos": "'", "quot": '"'
- }
-
- def close(self):
- try:
- self.parser.close()
- finally:
- self.parser = self.feed = None # nuke circular reference
-
- def handle_proc(self, tag, attr):
- m = re.search("encoding\s*=\s*['\"]([^\"']+)[\"']", attr)
- if m:
- self.handle_xml(m.group(1), 1)
-
- def handle_entityref(self, entity):
- # <string> entity
- try:
- self.handle_data(self.entity[entity])
- except KeyError:
- self.handle_data("&%s;" % entity)
-
-try:
- import sgmlop
-
- if not hasattr(sgmlop, "XMLParser"):
- raise ImportError
-
-except ImportError:
- SgmlopParser = None
-
-else:
- SgmlopParser = _SgmlopParser
-
-class _ExpatParser:
- def __init__(self, target):
-
- self._parser = parser = expat.ParserCreate(None, None)
- self._target = target
- parser.StartElementHandler = target.start
- parser.EndElementHandler = target.end
- parser.CharacterDataHandler = target.data
- encoding = None
-
- if not parser.returns_unicode:
- encoding = "utf-8"
-
- target.xml(encoding, None)
-
- def feed(self, data):
- self._parser.Parse(data, 0)
-
- def close(self):
- self._parser.Parse("", 1)
- del self._target, self._parser
-
-try:
- from xml.parsers import expat
-
- if not hasattr(expat, "ParserCreate"):
- raise ImportError
-
-except ImportError:
- ExpatParser = None
-
-else:
- ExpatParser = _ExpatParser
-
-class SlowParser:
- """Default XML parser (based on xmllib.XMLParser)."""
-
- def __init__(self, target):
- import xmllib
- if xmllib.XMLParser not in SlowParser.__bases__:
- SlowParser.__bases__ = (xmllib.XMLParser,)
-
- self.handle_xml = target.xml
- self.unknown_starttag = target.start
- self.handle_data = target.data
- self.handle_cdata = target.data
- self.unknown_endtag = target.end
-
- try:
- xmllib.XMLParser.__init__(self, accept_utf8=1)
- except TypeError:
- xmllib.XMLParser.__init__(self) # pre-2.0
-
-# --------------------------------------------------------------------
-# XML-RPC marshalling and unmarshalling code
-
-##
-# XML-RPC marshaller.
-#
-# @param encoding Default encoding for 8-bit strings. The default
-# value is None (interpreted as UTF-8).
-# @see dumps
-
-class Marshaller:
-
- dispatch = {}
-
- def __init__(self, encoding=None, allow_none=0):
- self.memo = {}
- self.data = None
- self.encoding = encoding
- self.allow_none = allow_none
-
- def dumps(self, values):
- out = []
- write = out.append
- dump = self.__dump
-
- if isinstance(values, Fault):
- # fault instance
- write("<fault>\n")
- dump({'faultCode': values.faultCode,
- 'faultString': values.faultString},
- write)
- write("</fault>\n")
-
- else:
- write("<params>\n")
-
- for v in values:
- write("<param>\n")
- dump(v, write)
- write("</param>\n")
-
- write("</params>\n")
-
- result = string.join(out, "")
-
- return result
-
- def __dump(self, value, write):
- try:
- f = self.dispatch[type(value)]
-
- except KeyError:
- raise TypeError, "cannot marshal %s objects" % type(value)
-
- else:
- f(self, value, write)
-
- def dump_nil (self, value, write):
- if not self.allow_none:
- raise TypeError, "cannot marshal None unless allow_none is enabled"
-
- write("<value><nil/></value>")
-
- dispatch[NoneType] = dump_nil
-
- def dump_int(self, value, write):
-
- if value > MAXINT or value < MININT:
- raise OverflowError, "int exceeds limits"
-
- write("<value><int>")
- write(str(value))
- write("</int></value>\n")
-
- dispatch[IntType] = dump_int
-
- if _bool_is_builtin:
- def dump_bool(self, value, write):
- write("<value><boolean>")
- write(value and "1" or "0")
- write("</boolean></value>\n")
-
- dispatch[bool] = dump_bool
-
- def dump_long(self, value, write):
- if value > MAXINT or value < MININT:
- raise OverflowError, "long int exceeds limits"
-
- write("<value><int>")
- write(str(int(value)))
- write("</int></value>\n")
-
- dispatch[LongType] = dump_long
-
- def dump_double(self, value, write):
- write("<value><double>")
- write(repr(value))
- write("</double></value>\n")
-
- dispatch[FloatType] = dump_double
-
- def dump_string(self, value, write, escape=escape):
- write("<value><string>")
- write(escape(value))
- write("</string></value>\n")
-
- dispatch[StringType] = dump_string
-
- if unicode:
- def dump_unicode(self, value, write, escape=escape):
- value = value.encode(self.encoding)
- write("<value><string>")
- write(escape(value))
- write("</string></value>\n")
-
- dispatch[UnicodeType] = dump_unicode
-
- def dump_array(self, value, write):
- i = id(value)
- if self.memo.has_key(i):
- raise TypeError, "cannot marshal recursive sequences"
-
- self.memo[i] = None
- dump = self.__dump
- write("<value><array><data>\n")
-
- for v in value:
- dump(v, write)
-
- write("</data></array></value>\n")
-
- del self.memo[i]
-
- dispatch[TupleType] = dump_array
- dispatch[ListType] = dump_array
-
- def dump_struct(self, value, write, escape=escape):
- i = id(value)
-
- if self.memo.has_key(i):
- raise TypeError, "cannot marshal recursive dictionaries"
-
- self.memo[i] = None
- dump = self.__dump
- write("<value><struct>\n")
-
- for k, v in value.items():
- write("<member>\n")
-
- if type(k) is not StringType:
- if unicode and type(k) is UnicodeType:
- k = k.encode(self.encoding)
-
- else:
- raise TypeError, "dictionary key must be string"
-
- write("<name>%s</name>\n" % escape(k))
- dump(v, write)
- write("</member>\n")
-
- write("</struct></value>\n")
- del self.memo[i]
-
- dispatch[DictType] = dump_struct
-
- if datetime:
- def dump_datetime(self, value, write):
- write("<value><dateTime.iso8601>")
- write(value.strftime("%Y%m%dT%H:%M:%S"))
- write("</dateTime.iso8601></value>\n")
-
- dispatch[datetime.datetime] = dump_datetime
-
- def dump_date(self, value, write):
- write("<value><dateTime.iso8601>")
- write(value.strftime("%Y%m%dT00:00:00"))
- write("</dateTime.iso8601></value>\n")
-
- dispatch[datetime.date] = dump_date
-
- def dump_time(self, value, write):
- write("<value><dateTime.iso8601>")
- write(datetime.datetime.now().date().strftime("%Y%m%dT"))
- write(value.strftime("%H:%M:%S"))
- write("</dateTime.iso8601></value>\n")
-
- dispatch[datetime.time] = dump_time
-
- def dump_instance(self, value, write):
- # check for special wrappers
- if value.__class__ in WRAPPERS:
- self.write = write
- value.encode(self)
- del self.write
-
- else:
- # store instance attributes as a struct (really?)
- self.dump_struct(value.__dict__, write)
-
- dispatch[InstanceType] = dump_instance
-
-class Unmarshaller:
-
- def __init__(self, use_datetime=0):
- self._type = None
- self._stack = []
- self._marks = []
- self._data = []
- self._methodname = None
- self._encoding = "utf-8"
- self.append = self._stack.append
- self._use_datetime = use_datetime
-
- if use_datetime and not datetime:
- raise ValueError, "the datetime module is not available"
-
- def close(self):
- # return response tuple and target method
- if self._type is None or self._marks:
- raise ResponseError()
-
- if self._type == "fault":
- raise Fault(**self._stack[0])
-
- return tuple(self._stack)
-
- def getmethodname(self):
- return self._methodname
-
- def xml(self, encoding, standalone):
- self._encoding = encoding
-
- def start(self, tag, attrs):
- if tag == "array" or tag == "struct":
- self._marks.append(len(self._stack))
-
- self._data = []
- self._value = (tag == "value")
-
- def data(self, text):
- self._data.append(text)
-
- def end(self, tag, join=string.join):
- # call the appropriate end tag handler
- try:
- f = self.dispatch[tag]
-
- except KeyError:
- pass
-
- else:
- return f(self, join(self._data, ""))
-
- def end_dispatch(self, tag, data):
-
- try:
- f = self.dispatch[tag]
-
- except KeyError:
- pass
-
- else:
- return f(self, data)
-
- dispatch = {}
-
- def end_nil (self, data):
- self.append(None)
- self._value = 0
-
- dispatch["nil"] = end_nil
-
- def end_boolean(self, data):
- if data == "0":
- self.append(False)
-
- elif data == "1":
- self.append(True)
-
- else:
- raise TypeError, "bad boolean value"
-
- self._value = 0
-
- dispatch["boolean"] = end_boolean
-
- def end_int(self, data):
- self.append(int(data))
- self._value = 0
-
- dispatch["i4"] = end_int
- dispatch["int"] = end_int
-
- def end_double(self, data):
- self.append(float(data))
- self._value = 0
-
- dispatch["double"] = end_double
-
- def end_string(self, data):
- if self._encoding:
- data = _decode(data, self._encoding)
-
- self.append(_stringify(data))
- self._value = 0
-
- dispatch["string"] = end_string
- dispatch["name"] = end_string # struct keys are always strings
-
- def end_array(self, data):
- mark = self._marks.pop()
- # map arrays to Python lists
- self._stack[mark:] = [self._stack[mark:]]
- self._value = 0
-
- dispatch["array"] = end_array
-
- def end_struct(self, data):
- mark = self._marks.pop()
- # map structs to Python dictionaries
- dict = {}
- items = self._stack[mark:]
-
- for i in range(0, len(items), 2):
- dict[_stringify(items[i])] = items[i + 1]
-
- self._stack[mark:] = [dict]
- self._value = 0
-
- dispatch["struct"] = end_struct
-
- def end_base64(self, data):
- value = Binary()
- value.decode(data)
- self.append(value)
- self._value = 0
-
- dispatch["base64"] = end_base64
-
- def end_dateTime(self, data):
- value = DateTime()
- value.decode(data)
-
- if self._use_datetime:
- value = _datetime_type(data)
-
- self.append(value)
-
- dispatch["dateTime.iso8601"] = end_dateTime
-
- def end_value(self, data):
- if self._value:
- self.end_string(data)
-
- dispatch["value"] = end_value
-
- def end_params(self, data):
- self._type = "params"
-
- dispatch["params"] = end_params
-
- def end_fault(self, data):
- self._type = "fault"
-
- dispatch["fault"] = end_fault
-
- def end_methodName(self, data):
- if self._encoding:
- data = _decode(data, self._encoding)
-
- self._methodname = data
- self._type = "methodName"
-
- dispatch["methodName"] = end_methodName
-
-def getparser(use_datetime=0):
-
- if use_datetime and not datetime:
- raise ValueError, "the datetime module is not available"
-
- if FastParser and FastUnmarshaller:
- if use_datetime:
- mkdatetime = _datetime_type
-
- else:
- mkdatetime = _datetime
-
- target = FastUnmarshaller(True, False, _binary, mkdatetime, Fault)
- parser = FastParser(target)
-
- else:
- target = Unmarshaller(use_datetime=use_datetime)
-
- if FastParser:
- parser = FastParser(target)
-
- elif SgmlopParser:
- parser = SgmlopParser(target)
-
- elif ExpatParser:
- parser = ExpatParser(target)
-
- else:
- parser = SlowParser(target)
-
- return parser, target
-
-def dumps(params, methodname=None, methodresponse=None, encoding=None,
- allow_none=0):
-
- assert isinstance(params, TupleType) or isinstance(params, Fault),\
- "argument must be tuple or Fault instance"
-
- if isinstance(params, Fault):
- methodresponse = 1
-
- elif methodresponse and isinstance(params, TupleType):
- assert len(params) == 1, "response tuple must be a singleton"
-
- if not encoding:
- encoding = "utf-8"
-
- if FastMarshaller:
- m = FastMarshaller(encoding)
-
- else:
- m = Marshaller(encoding, allow_none)
-
- data = m.dumps(params)
-
- if encoding != "utf-8":
- xmlheader = "<?xml version='1.0' encoding='%s'?>\n" % str(encoding)
-
- else:
- xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default
-
- # standard XML-RPC wrappings
- if methodname:
- if not isinstance(methodname, StringType):
- methodname = methodname.encode(encoding)
-
- data = (
- xmlheader,
- "<methodCall>\n"
- "<methodName>", methodname, "</methodName>\n",
- data,
- "</methodCall>\n"
- )
-
- elif methodresponse:
- # a method response, or a fault structure
- data = (
- xmlheader,
- "<methodResponse>\n",
- data,
- "</methodResponse>\n"
- )
-
- else:
- return data
-
- return string.join(data, "")
-
-def loads(data, use_datetime=0):
- p, u = getparser(use_datetime=use_datetime)
- p.feed(data)
- p.close()
- return u.close(), u.getmethodname()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-20 15:46:57
|
Revision: 312
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=312&view=rev
Author: n3rd3x
Date: 2008-10-20 15:46:50 +0000 (Mon, 20 Oct 2008)
Log Message:
-----------
openlh-server/src/OpenlhServer/certgen: This file is removed
Modified Paths:
--------------
trunk/openlh-server/src/OpenlhServer/Makefile.am
trunk/openlh-server/src/OpenlhServer/__init__.py
Removed Paths:
-------------
trunk/openlh-server/src/OpenlhServer/certgen.py
Modified: trunk/openlh-server/src/OpenlhServer/Makefile.am
===================================================================
--- trunk/openlh-server/src/OpenlhServer/Makefile.am 2008-10-20 15:45:01 UTC (rev 311)
+++ trunk/openlh-server/src/OpenlhServer/Makefile.am 2008-10-20 15:46:50 UTC (rev 312)
@@ -3,7 +3,6 @@
openlhdir = $(pythondir)/OpenlhServer
openlh_PYTHON = \
__init__.py \
- certgen.py \
daemon.py \
globals.py \
g_timer.py \
Modified: trunk/openlh-server/src/OpenlhServer/__init__.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/__init__.py 2008-10-20 15:45:01 UTC (rev 311)
+++ trunk/openlh-server/src/OpenlhServer/__init__.py 2008-10-20 15:46:50 UTC (rev 312)
@@ -17,4 +17,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__all__ = ('daemon', 'globals', 'ui', 'db', 'g_timer',
- 'utils', 'certgen', 'config', 'plugins')
+ 'utils', 'config', 'plugins')
Deleted: trunk/openlh-server/src/OpenlhServer/certgen.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/certgen.py 2008-10-20 15:45:01 UTC (rev 311)
+++ trunk/openlh-server/src/OpenlhServer/certgen.py 2008-10-20 15:46:50 UTC (rev 312)
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2008 Wilson Pinto Júnior (N3RD3X) <n3...@gu...>
-# Copyright (C) 2008 Gabriel Falcão <ga...@na...>
-#
-# 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, see <http://www.gnu.org/licenses/>.
-
-import sys
-import os
-
-TYPE_RSA = 0
-TYPE_DSA = 1
-
-from OpenlhServer.utils import execute_command, is_in_path
-
-CERTTOOL_PATH = is_in_path("certtool")
-
-class CreateTemplateError(Exception): pass
-
-def generate_private_key(type=TYPE_RSA, bits=1024):
-
- print CERTTOOL_PATH
-
- cmd = [CERTTOOL_PATH, "--generate-privkey", "--bits", str(bits)]
-
- if type == TYPE_DSA:
- cmd.append('--dsa')
-
- (stdout, stderr, retval) = execute_command(cmd)
-
- if retval != 0:
- raise SystemError(stderr)
- else:
- return stdout
-
-def generate_self_signed(template_file, privkey_file):
-
- cmd = [CERTTOOL_PATH, "--template", template_file, "--generate-self-signed",
- "--load-privkey", privkey_file]
-
- (stdout, stderr, retval) = execute_command(cmd)
-
- if retval != 0:
- raise IOError(stdout)
- else:
- return stdout
-
-def create_template(organization, common_name, expiration_days, email=None,
- unit=None, locality=None, state=None, country=None):
-
- data = []
- data.append('organization = "%s"' % organization)
-
- if unit:
- data.append('unit = "%s"' % unit)
-
- if locality:
- data.append('locality = "%s"' % locality)
-
- if state:
- data.append('state = "%s"' % state)
-
- if country:
- data.append('country = %s' % country)
-
- data.append('cn = "%s"' % common_name)
- data.append('expiration_days = %d' % expiration_days)
-
- if email:
- data.append('email = "%s"' % email)
-
- return '\n'.join(data)
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-20 15:45:12
|
Revision: 311
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=311&view=rev
Author: n3rd3x
Date: 2008-10-20 15:45:01 +0000 (Mon, 20 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/openlh-client/src/openlh-client
trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py
trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py
trunk/openlh-core/src/OpenlhCore/net/certgen/openssl_certgen.py
trunk/openlh-core/src/OpenlhCore/net/client.py
trunk/openlh-core/src/OpenlhCore/net/constants.py
trunk/openlh-server/data/ui/main.ui
trunk/openlh-server/data/ui/prefs.ui
trunk/openlh-server/src/OpenlhServer/ui/main.py
trunk/openlh-server/src/openlh-server
Modified: trunk/openlh-client/src/openlh-client
===================================================================
--- trunk/openlh-client/src/openlh-client 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-client/src/openlh-client 2008-10-20 15:45:01 UTC (rev 311)
@@ -79,6 +79,7 @@
from OpenlhClient import main
from OpenlhClient.utils import rename_process, generate_id_bytime
from OpenlhClient.ui import dialogs
+from OpenlhCore.net import certgen
if os.name == 'posix':
log_normal_format = ('\033[0;33m%(name)-17s ' +
@@ -127,9 +128,12 @@
host)
else:
sys.exit(0)
+
+ def generate_keys(self):
+ """
+ Generate all keys and certificates required for execution
+ """
- def generate_privkey(self):
-
try:
os.remove(CLIENT_TLS_KEY)
except:
@@ -141,68 +145,28 @@
pass
mkdir(CERTS_PATH)
-
- try:
- import certtool
- HAS_CERTTOOL = True
- logging.debug("python-certtool found")
- except ImportError:
- HAS_CERTTOOL = False
- logging.debug("python-certtool not found")
-
- if HAS_CERTTOOL:
- USE_PY_CERTTOOL = True
- elif bool(certgen.CERTTOOL_PATH):
- USE_PY_CERTTOOL = False
- else:
- dialogs.ok_only(_('<big><b>Required Module Has Not Found</b></big>' +
- '\n\nPlease install python-certtool to run this ' +
- 'application.'),
- ICON=gtk.MESSAGE_ERROR)
-
- sys.exit(2)
try:
logging.debug("Generating Privkey")
- if USE_PY_CERTTOOL:
- privkey_obj = certtool.generate_private_key(bits=1024)
- privkey = privkey_obj.export()
- else:
- privkey = certgen.generate_private_key()
-
- open(CLIENT_TLS_KEY, 'w').write(privkey)
+ privkey = certgen.generate_private_key()
+ open(CLIENT_TLS_KEY, 'w').write(privkey.export())
- if USE_PY_CERTTOOL:
- template_obj = certtool.Template()
- template_obj.organization = _('OpenLanhouse-Client')
- template_obj.expiration_days = 1825
- template_obj.common_name = APP_NAME
-
- else:
- certdata = {'organization': _('OpenLanhouse-Client'),
- 'expiration_days': 1825,
- 'common_name': APP_NAME
- }
-
- template = certgen.create_template(**certdata)
- open(CLIENT_TLS_TEMPLATE, 'w').write(template)
+ logging.debug("Generating Template")
+ template = certgen.Template(CLIENT_TLS_TEMPLATE)
+ template.organization = _("OpenLanhouse Client")
+ template.expiration_days = 1825
- if USE_PY_CERTTOOL:
- certificate_obj = certtool.generate_self_signed(privkey=privkey_obj,
- template=template_obj,
- dig=certtool.DIG_SHA1)
- certificate = certificate_obj.export()
- else:
- certificate = certgen.generate_self_signed(CLIENT_TLS_TEMPLATE,
- CLIENT_TLS_KEY)
+ template.common_name = APP_NAME
- open(CLIENT_TLS_CERT, 'w').write(certificate)
+ logging.debug("Generating SelfSigned Certificate")
- if not USE_PY_CERTTOOL:
- os.remove(CLIENT_TLS_TEMPLATE)
+ certificate = certgen.generate_self_signed(privkey=privkey,
+ template=template)
+ open(CLIENT_TLS_CERT, 'w').write(certificate.export())
+
except Exception, error:
dialogs.ok_only(_('<big><b>Cannot Generate Private Key</b></big>' +
'\n\n%s') % str(error),
@@ -237,7 +201,7 @@
def run(self):
if not(os.path.exists(CLIENT_TLS_KEY)) or not(os.path.exists(CLIENT_TLS_CERT)):
- self.generate_privkey()
+ self.generate_keys()
app = main.Client()
self.stop_gnome_screensaver()
Modified: trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py 2008-10-20 15:45:01 UTC (rev 311)
@@ -17,3 +17,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__all__ = ("gnutls_certgen", "openssl_certgen")
+
+from OpenlhCore.net.certgen.gnutls_certgen import * #default backend
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py 2008-10-20 15:45:01 UTC (rev 311)
@@ -16,26 +16,48 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from OpenlhCore.utils import execute_command, is_in_path
+from OpenlhCore import certtool
-CERTTOOL_PATH = is_in_path("certtool")
+class PrivateKey:
+ """
+ Private Key Object
+ """
+ def __init__(self, privkey_obj):
+ self.privkey_obj = privkey_obj
+
+ def export(self):
+ """
+ Export private key in PEM format
+ """
+ return self.privkey_obj.export()
-def generate_keys(privkey_path, selfsigned_path, template_path,
- bits, data):
+class Template(certtool.Template):
+ """
+ Template Object
+ """
+ def __init__(self, path):
+ certtool.Template.__init__(self)
+
+class SelfSigned:
+ """
+ SelfSigned Certificate
+ """
+ def __init__(self, selfsigned_obj):
+ self.selfsigned_obj = selfsigned_obj
- if not CERTTOOL_PATH:
- raise SystemError("certtool is not installed, please install it")
+ def export(self):
+ """
+ Export self-signed Certificate in PEM format
+ """
+ return self.selfsigned_obj.export()
+
+def generate_private_key(bits=1024):
+ privkey_obj = certtool.generate_private_key(bits=bits)
+ return PrivateKey(privkey_obj)
+
+def generate_self_signed(privkey, template):
+ certificate = certtool.generate_self_signed(privkey=privkey.privkey_obj,
+ template=template,
+ dig=certtool.DIG_SHA1)
- cmd = [CERTTOOL_PATH, "--generate-privkey", "--bits", str(bits)]
-
- (stdout, stderr, retval) = execute_command(cmd)
-
- if retval != 0:
- raise SystemError(stderr)
- else:
- print stdout, stderr, retval
-
- print "Certtool:%s\nPrivkey:%s\nSelfSigned:%s\nTemplate:%s\nBits:%d\n" % (CERTTOOL_PATH, privkey_path,
- selfsigned_path,
- template_path,
- bits)
+ return SelfSigned(certificate)
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/certgen/openssl_certgen.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/openssl_certgen.py 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/openssl_certgen.py 2008-10-20 15:45:01 UTC (rev 311)
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
#
# 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
Modified: trunk/openlh-core/src/OpenlhCore/net/client.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/client.py 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-core/src/OpenlhCore/net/client.py 2008-10-20 15:45:01 UTC (rev 311)
@@ -261,7 +261,6 @@
#headers
if data.startswith('-----'):
-
try:
data = self.handle_headers(data)
except Exception, error:
Modified: trunk/openlh-core/src/OpenlhCore/net/constants.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/constants.py 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-core/src/OpenlhCore/net/constants.py 2008-10-20 15:45:01 UTC (rev 311)
@@ -39,5 +39,5 @@
XMLRequestRegex = re.compile(r'-----BEGIN XMLREQUEST'
r' ID=(?P<id>\d+) SIZE=(?P<size>\d+)-----(?P<data>(.*))')
-SendFileRegex = re.compile(r'-----BEGIN SENDFILE METHOD=(?P<method>[\w.]+) '
+SendFileRegex = re.compile(r'-----BEGIN SENDFILE ID=(?P<id>\d+) METHOD=(?P<method>[\w._]+) '
r'SIZE=(?P<size>\d+)-----(?P<data>(.*))')
\ No newline at end of file
Modified: trunk/openlh-server/data/ui/main.ui
===================================================================
--- trunk/openlh-server/data/ui/main.ui 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-server/data/ui/main.ui 2008-10-20 15:45:01 UTC (rev 311)
@@ -494,7 +494,7 @@
</child>
<child>
<object class="GtkAction" id="ticket_menuitem">
- <property name="visible">False</property>
+ <property name="visible">True</property>
<property name="stock_id">gtk-new</property>
<property name="name">ticket_menuitem</property>
<property name="label" translatable="yes">_Ticket</property>
Modified: trunk/openlh-server/data/ui/prefs.ui
===================================================================
--- trunk/openlh-server/data/ui/prefs.ui 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-server/data/ui/prefs.ui 2008-10-20 15:45:01 UTC (rev 311)
@@ -236,7 +236,7 @@
</child>
<child>
<object class="GtkCheckButton" id="ticket_suport">
- <property name="visible">False</property>
+ <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Ticket support</property>
Modified: trunk/openlh-server/src/OpenlhServer/ui/main.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/ui/main.py 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-server/src/OpenlhServer/ui/main.py 2008-10-20 15:45:01 UTC (rev 311)
@@ -63,6 +63,8 @@
self.gconf_client = gconf.client_get_default()
self.gconf_client.add_dir('/apps/openlh-server',
gconf.CLIENT_PRELOAD_NONE)
+ self.gconf_client.notify_add("/apps/openlh-server/ticket_suport",
+ self.on_ticket_suport_cb)
self.icons = icons.Icons()
self.status_icons = icons.Icons(icon_path=STATUS_ICON_PATH)
@@ -2104,3 +2106,14 @@
dlg = PluginsWindow(MainWindow=self, Daemon=self.daemon,
Parent=self.mainwindow)
dlg.run()
+
+ def on_ticket_suport_cb(self, client, cnxn_id, entry, what):
+ value = entry.get_value().get_bool()
+ ui_manager3 = self.xml.get_object("uimanager3")
+
+ widget = ui_manager3.get_widget('ticket_menuitem')
+
+ if value:
+ widget.show()
+ else:
+ widget.hide()
Modified: trunk/openlh-server/src/openlh-server
===================================================================
--- trunk/openlh-server/src/openlh-server 2008-10-18 12:04:24 UTC (rev 310)
+++ trunk/openlh-server/src/openlh-server 2008-10-20 15:45:01 UTC (rev 311)
@@ -26,10 +26,11 @@
disable_autodebug = False
verbose = False
+debug_color = "auto"
try:
- opts, args = getopt.getopt(sys.argv[1:], 'hvp:', ['help', 'verbose',
- 'disable-autoverbose', 'version'])
+ opts, args = getopt.getopt(sys.argv[1:], 'hvp:', ['help', 'verbose=',
+ 'version', 'debugcolor='])
except getopt.error, msg:
print msg
@@ -39,19 +40,31 @@
for o, a in opts:
if o in ('-h', '--help'):
- print sys.argv[0], '[--help] [--verbose] [--disable-autoverbose] [--version]'
+ print sys.argv[0], '[--help] [--verbose] [--debugcolor] [--version]'
sys.exit()
elif o == '--verbose':
+
verbose = False
+
+ if a == "on":
+ verbose = True
+ disable_autodebug = False
+ elif a == "off":
+ verbose = False
+ disable_autodebug = True
+ else:
+ disable_autodebug = False
- elif o == '--disable-autoverbose':
- disable_autodebug = True
-
elif o == '--version':
print APP_NAME, APP_VERSION
sys.exit()
+
+ if o == '--debugcolor':
+ debug_color = a
+ else:
+ debug_color = "auto"
try:
import pygtk
@@ -76,23 +89,25 @@
sys.exit(3)
from time import strftime
-from OpenlhServer import daemon, certgen
+from OpenlhServer import daemon
from OpenlhServer.utils import rename_process, mkdir, md5_cripto, pid_alive
from OpenlhServer.ui import dialogs, main
+from OpenlhCore.net import certgen
+
# Check ANSI colors, only available in POSIX
-if os.name == 'posix':
+if (debug_color == "auto" and os.name == 'posix') or debug_color=="on":
log_normal_format = ('\033[0;33m%(name)-17s '
'\033[0;31m%(levelname)-8s '
- '\033[0;37m%(message)s')
+ '\033[0;37m%(message)s\033[0m')
log_debug_format = ('\033[0;32m%(asctime)s '
'\033[0;31m%(levelname)-6s '
'\033[0;33m%(name)-17s '
- '\033[0;37m%(message)s')
+ '\033[40;1;37m%(message)s\033[0m')
else:
- log_normal_format = '%(name)-14s %(levelname)-8s %(message)s'
- log_debug_format = '%(asctime)s (levelname)-6s (name)-17s (message)s'
+ log_normal_format = ('%(name)-17s %(levelname)-8s %(message)s')
+ log_debug_format = ('%(asctime)s %(levelname)-6s %(name)-17s %(message)s')
log_format = log_normal_format
log_level = logging.CRITICAL
@@ -156,7 +171,10 @@
self.gconf_client.set_float("/apps/openlh-server/price_per_hour",
self.price_per_hour)
- def generate_privkey(self):
+ def generate_keys(self):
+ """
+ Generate all keys and certificates required for execution
+ """
try:
os.remove(SERVER_TLS_KEY)
@@ -169,75 +187,31 @@
pass
mkdir(CERTS_PATH)
-
- try:
- import certtool
- HAS_CERTTOOL = True
- logging.debug("python-certtool found")
- except ImportError:
- HAS_CERTTOOL = False
- logging.debug("python-certtool not found")
-
- if HAS_CERTTOOL:
- USE_PY_CERTTOOL = True
- elif bool(certgen.CERTTOOL_PATH):
- USE_PY_CERTTOOL = False
- else:
- dialogs.ok_only(_('<big><b>Required Module Has Not Found</b></big>'
- '\n\nPlease install python-certtool to run this '
- 'application.'),
- ICON=gtk.MESSAGE_ERROR)
-
- sys.exit(2)
try:
logging.debug("Generating Privkey")
- if USE_PY_CERTTOOL:
- privkey_obj = certtool.generate_private_key(bits=1024)
- privkey = privkey_obj.export()
- else:
- privkey = certgen.generate_private_key()
-
- open(SERVER_TLS_KEY, 'w').write(privkey)
+ privkey = certgen.generate_private_key()
+ open(SERVER_TLS_KEY, 'w').write(privkey.export())
- if USE_PY_CERTTOOL:
- template_obj = certtool.Template()
- template_obj.organization = self.name
- template_obj.expiration_days = 1825
-
- if self.admin_email:
- template_obj.email = self.admin_email
-
- template_obj.common_name = APP_NAME
-
- else:
- certdata = {'organization': self.name,
- 'expiration_days': 1825,
- 'common_name': APP_NAME
- }
-
- if self.admin_email:
- certdata['email'] = self.admin_email
-
- template = certgen.create_template(**certdata)
- open(SERVER_TLS_TEMPLATE, 'w').write(template)
+ logging.debug("Generating Template")
+ template = certgen.Template(SERVER_TLS_TEMPLATE)
+ template.organization = self.name
+ template.expiration_days = 1825
- if USE_PY_CERTTOOL:
- certificate_obj = certtool.generate_self_signed(privkey=privkey_obj,
- template=template_obj,
- dig=certtool.DIG_SHA1)
- certificate = certificate_obj.export()
- else:
- certificate = certgen.generate_self_signed(SERVER_TLS_TEMPLATE,
- SERVER_TLS_KEY)
+ if self.admin_email:
+ template.email = self.admin_email
- open(SERVER_TLS_CERT, 'w').write(certificate)
+ template.common_name = APP_NAME
- if not USE_PY_CERTTOOL:
- os.remove(SERVER_TLS_TEMPLATE)
+ logging.debug("Generating SelfSigned Certificate")
+ certificate = certgen.generate_self_signed(privkey=privkey,
+ template=template)
+
+ open(SERVER_TLS_CERT, 'w').write(certificate.export())
+
except Exception, error:
dialogs.ok_only(_('<big><b>Cannot Generate Private Key</b></big>' +
'\n\n%s') % str(error),
@@ -258,7 +232,7 @@
def run(self):
if not(os.path.exists(SERVER_TLS_KEY)) or not(os.path.exists(SERVER_TLS_CERT)):
- self.generate_privkey()
+ self.generate_keys()
appdaemon = daemon.Server()
appgui = main.Manager(appdaemon)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-16 20:03:35
|
Revision: 308
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=308&view=rev
Author: n3rd3x
Date: 2008-10-16 20:03:22 +0000 (Thu, 16 Oct 2008)
Log Message:
-----------
Added the avatar support
Modified Paths:
--------------
trunk/openlh-server/data/ui/add_user.ui
trunk/openlh-server/data/ui/edit_user.ui
trunk/openlh-server/src/OpenlhServer/globals.py
trunk/openlh-server/src/OpenlhServer/plugins/example/__init__.py
trunk/openlh-server/src/OpenlhServer/ui/dialogs.py
trunk/openlh-server/src/OpenlhServer/ui/main.py
trunk/openlh-server/src/OpenlhServer/utils.py
trunk/openlh-server/src/openlh-server
Modified: trunk/openlh-server/data/ui/add_user.ui
===================================================================
--- trunk/openlh-server/data/ui/add_user.ui 2008-10-15 20:07:49 UTC (rev 307)
+++ trunk/openlh-server/data/ui/add_user.ui 2008-10-16 20:03:22 UTC (rev 308)
@@ -47,6 +47,29 @@
<placeholder/>
</child>
<child>
+ <object class="GtkButton" id="user_avatar_button">
+ <property name="visible">True</property>
+ <signal handler="on_user_avatar_clicked" name="clicked"/>
+ <child>
+ <object class="GtkImage" id="user_avatar_image">
+ <property name="visible">True</property>
+ <property name="width-request">64</property>
+ <property name="height-request">94</property>
+ <property name="icon-name">stock_person</property>
+ <property name="icon-size">6</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkImage" id="nick_status_image">
<property name="width_request">15</property>
<property name="height_request">15</property>
@@ -55,8 +78,8 @@
<property name="icon_size">2</property>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@@ -71,8 +94,8 @@
<signal handler="on_nick_insert_text" name="insert_text"/>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
</packing>
</child>
<child>
@@ -86,8 +109,8 @@
<property name="mnemonic_widget">nick</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -102,8 +125,8 @@
<property name="use_underline">True</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
@@ -123,6 +146,8 @@
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@@ -136,8 +161,8 @@
<property name="width_chars">20</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
@@ -154,6 +179,8 @@
<property name="mnemonic_widget">full_name</property>
</object>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -167,8 +194,8 @@
<property name="width_chars">20</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -184,8 +211,8 @@
<property name="mnemonic_widget">identity</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
@@ -201,8 +228,8 @@
<property name="width_chars">14</property>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"/>
@@ -220,6 +247,8 @@
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
@@ -233,8 +262,8 @@
<property name="width_chars">20</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
@@ -811,7 +840,6 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</object>
Modified: trunk/openlh-server/data/ui/edit_user.ui
===================================================================
--- trunk/openlh-server/data/ui/edit_user.ui 2008-10-15 20:07:49 UTC (rev 307)
+++ trunk/openlh-server/data/ui/edit_user.ui 2008-10-16 20:03:22 UTC (rev 308)
@@ -41,6 +41,29 @@
<placeholder/>
</child>
<child>
+ <object class="GtkButton" id="user_avatar_button">
+ <property name="visible">True</property>
+ <signal handler="on_user_avatar_clicked" name="clicked"/>
+ <child>
+ <object class="GtkImage" id="user_avatar_image">
+ <property name="visible">True</property>
+ <property name="width-request">64</property>
+ <property name="height-request">94</property>
+ <property name="icon-name">stock_person</property>
+ <property name="icon-size">6</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkImage" id="nick_status_image">
<property name="width_request">15</property>
<property name="height_request">15</property>
@@ -49,8 +72,8 @@
<property name="icon_size">2</property>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@@ -64,8 +87,8 @@
<property name="width_chars">20</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
@@ -81,10 +104,12 @@
<property name="mnemonic_widget">phone</property>
</object>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_EXPAND</property>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
@@ -96,8 +121,8 @@
<property name="width_chars">14</property>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"/>
@@ -114,8 +139,8 @@
<property name="mnemonic_widget">identity</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
@@ -133,8 +158,8 @@
<property name="mnemonic_widget">nick</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -149,8 +174,8 @@
<signal handler="on_nick_insert_text" name="insert_text"/>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="y_options"/>
</packing>
</child>
@@ -163,8 +188,8 @@
<property name="width_chars">20</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@@ -179,6 +204,8 @@
<property name="mnemonic_widget">full_name</property>
</object>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@@ -192,8 +219,8 @@
<property name="width_chars">20</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
@@ -210,6 +237,8 @@
<property name="mnemonic_widget">email</property>
</object>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
@@ -226,8 +255,8 @@
<property name="use_underline">True</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
@@ -547,12 +576,12 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
- <object class="GtkButton" id="cancel_bnt">
+ <object class="GtkButton" id="help_bnt">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">gtk-cancel</property>
+ <property name="label" translatable="yes">gtk-help</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -560,6 +589,16 @@
</packing>
</child>
<child>
+ <object class="GtkButton" id="cancel_bnt">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ <child>
<object class="GtkButton" id="ok_bnt">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -568,9 +607,6 @@
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
</object>
<packing>
Modified: trunk/openlh-server/src/OpenlhServer/globals.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/globals.py 2008-10-15 20:07:49 UTC (rev 307)
+++ trunk/openlh-server/src/OpenlhServer/globals.py 2008-10-16 20:03:22 UTC (rev 308)
@@ -48,6 +48,7 @@
CERTS_PATH = ospath.join(CONFIG_PATH, 'certs')
UI_PATH = ospath.join(CUR_PATH, 'ui')
CACHE_PATH = ospath.join(CONFIG_PATH, 'cache')
+AVATARS_PATH = ospath.join(CONFIG_PATH, 'avatars')
BACKGROUND_CACHE = ospath.join(CACHE_PATH, 'wallpaper')
LOGO_CACHE = ospath.join(CACHE_PATH, 'logo')
Modified: trunk/openlh-server/src/OpenlhServer/plugins/example/__init__.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/plugins/example/__init__.py 2008-10-15 20:07:49 UTC (rev 307)
+++ trunk/openlh-server/src/OpenlhServer/plugins/example/__init__.py 2008-10-16 20:03:22 UTC (rev 308)
@@ -1,3 +1,20 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior (N3RD3X) <n3...@gu...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
PLUGIN_NAME = "Example"
PLUGIN_DESCRIPTION = "Plugin Example"
Modified: trunk/openlh-server/src/OpenlhServer/ui/dialogs.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/ui/dialogs.py 2008-10-15 20:07:49 UTC (rev 307)
+++ trunk/openlh-server/src/OpenlhServer/ui/dialogs.py 2008-10-16 20:03:22 UTC (rev 308)
@@ -27,6 +27,7 @@
from os import name as osname
from os import path as ospath
+from os import remove as os_remove
from time import localtime
from threading import Lock
from OpenlhServer.ui import icons, DateEdit, HourEntry
@@ -34,6 +35,7 @@
from OpenlhServer.ui.utils import color_entry
from OpenlhServer.utils import calculate_time, calculate_credit, md5_cripto, check_nick, check_name
from OpenlhServer.utils import is_in_path, execute_command, threaded, get_gtk_builder
+from OpenlhServer.utils import user_has_avatar, get_user_avatar_path
from OpenlhServer.db.models import CashFlowItem, User
GNOME_OPEN_PATH = is_in_path('gnome-open')
@@ -259,6 +261,90 @@
self.set_preview_widget_active(False)
self.use_preview = False
+class ImageChooserDialog(gtk.FileChooserDialog):
+ def __init__(self, parent=None):
+ gtk.FileChooserDialog.__init__(self, title='Choose Image',
+ parent=parent,
+ action=gtk.FILE_CHOOSER_ACTION_OPEN,
+ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
+ gtk.STOCK_OPEN, gtk.RESPONSE_OK,
+ _("_No Image"), gtk.RESPONSE_NONE))
+
+ self.toggle = gtk.CheckButton("Preview images")
+ self.set_extra_widget(self.toggle)
+ self.toggle.set_active(True)
+ self.toggle.connect('toggled', self.toggled_cb)
+ self.toggle.show()
+ self.use_preview = True
+
+ filter = gtk.FileFilter()
+ filter.set_name(_('All files'))
+ filter.add_pattern('*')
+ self.add_filter(filter)
+
+ filter = gtk.FileFilter()
+ filter.set_name(_('Images') )
+ filter.add_mime_type('image/png')
+ filter.add_mime_type('image/jpeg')
+ filter.add_mime_type('image/gif')
+ filter.add_mime_type('image/tiff')
+ filter.add_mime_type('image/svg+xml')
+ filter.add_mime_type('image/x-xpixmap')
+ self.add_filter(filter)
+ self.set_filter(filter)
+
+ if osname == 'posix' and ospath.exists('/usr/share/pixmaps'):
+ self.add_shortcut_folder('/usr/share/pixmaps')
+
+ self.set_use_preview_label(False)
+ self.previewidget = gtk.Image()
+ self.set_preview_widget(self.previewidget)
+ self.connect("update-preview", self.update_preview_cb, self.previewidget)
+
+ def update_preview_cb(self, file_chooser, preview):
+
+ if not self.use_preview:
+ return
+
+ filename = file_chooser.get_preview_filename()
+
+ try:
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename,
+ PREVIEW_SIZE, PREVIEW_SIZE)
+ self.previewidget.set_from_pixbuf(pixbuf)
+ self.have_preview = True
+
+ except:
+ self.have_preview = False
+
+ self.set_preview_widget_active(self.have_preview)
+ return
+
+ def toggled_cb(self, obj):
+ if obj.get_active():
+ filename = self.get_preview_filename()
+
+ try:
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename,
+ PREVIEW_SIZE, PREVIEW_SIZE)
+ self.previewidget.set_from_pixbuf(pixbuf)
+ self.have_preview = True
+ except:
+ self.have_preview = False
+
+ self.set_preview_widget_active(self.have_preview)
+ self.use_preview = True
+
+ else:
+ self.set_preview_widget_active(False)
+ self.use_preview = False
+
+ def run(self):
+ response = gtk.FileChooserDialog.run(self)
+ file = self.get_filename()
+ self.hide()
+ return response, file
+
class user_edit:
ui_file = 'edit_user'
@@ -274,6 +360,8 @@
warns = []
faults = []
+ user_avatar = None
+
def __init__(self, users_manager, Parent=None):
self.users_manager = users_manager
@@ -288,10 +376,9 @@
self.notes = self.xml.get_object('notes')
self.address = self.xml.get_object('address')
self.cancel_bnt = self.xml.get_object('cancel_bnt')
+ self.user_avatar_button = self.xml.get_object('user_avatar_button')
+ self.user_avatar_image = self.xml.get_object('user_avatar_image')
- if self.cancel_bnt:
- self.buttonbox.set_child_secondary(self.cancel_bnt, True)
-
self.ok_bnt = self.xml.get_object('ok_bnt')
self.notesbuffer = self.notes.get_buffer()
self.addressbuffer = self.address.get_buffer()
@@ -300,7 +387,7 @@
self.xml.get_object('nick_status_image').set_from_file(None)
self.birth = DateEdit.DateEdit()
- self.table2.attach(self.birth, 3, 4, 2, 3,
+ self.table2.attach(self.birth, 4, 5, 2, 3,
xoptions=gtk.FILL, yoptions=gtk.FILL)
self.birth.show()
@@ -391,7 +478,48 @@
self._nick_timeout_id = gobject.timeout_add(timeout,
self.on_nick_changed_done)
+
+ def on_user_avatar_clicked(self, obj):
+ dlg = ImageChooserDialog()
+ response, image_file = dlg.run()
+ if response == gtk.RESPONSE_NONE:
+ self.user_avatar = None
+ self.user_avatar_image.set_from_icon_name("stock_person", 6)
+
+ #Remove Avatar File
+ if user_has_avatar(self.data['id']):
+ try:
+ os_remove(get_user_avatar_path(self.data['id']))
+ except Exception , e:
+ print str(e)
+
+
+ if response == gtk.RESPONSE_OK:
+ self.user_avatar = image_file
+
+ pixbuf = gtk.gdk.pixbuf_new_from_file(image_file)
+
+ if not pixbuf:
+ return
+
+ #Calculate resize
+ height = pixbuf.get_height()
+ width = pixbuf.get_width()
+
+ k = width / 64.0
+ l = height / 94.0
+
+ if k >= l:
+ x = 64
+ y = height / k
+ else:
+ x = width / l
+ y = 94
+
+ pixbuf = pixbuf.scale_simple(int(x), int(y), gtk.gdk.INTERP_TILES)
+ self.user_avatar_image.set_from_pixbuf(pixbuf)
+
def reset_data(self):
for key in self.input.keys():
@@ -427,6 +555,11 @@
if user.birth:
self.data['birth'] = user.birth
self.birth.set_time(map(int, self.data['birth'].split('-')))
+
+ self.data['id'] = user.id
+
+ if user_has_avatar(user.id):
+ self.user_avatar_image.set_from_file(get_user_avatar_path(user.id))
def get_data(self):
@@ -471,7 +604,21 @@
user.__setattr__(key, value)
self.users_manager.update(user)
+
+ #Avatar
+ try:
+ avatar_pixbuf = self.user_avatar_image.get_pixbuf()
+ except ValueError:
+ avatar_pixbuf = None
+
+ if self.user_avatar and avatar_pixbuf:
+ path = get_user_avatar_path(user.id)
+ try:
+ avatar_pixbuf.save(path, "jpeg", {"quality":"100"})
+ except Exception, error:
+ print error
+
self.users.destroy()
def check_obj(self, obj, name):
@@ -526,6 +673,11 @@
self.notebook = self.xml.get_object("notebook")
self.faults = ['nick', 'full_name']
+ self.help_bnt = gtk.Button(stock=gtk.STOCK_HELP)
+ self.buttonbox.pack_start(self.help_bnt)
+ self.help_bnt.connect("clicked", self.on_help_button_clicked)
+ self.buttonbox.set_child_secondary(self.help_bnt, True)
+
self.cancel_bnt = gtk.Button(stock=gtk.STOCK_CANCEL)
self.buttonbox.pack_start(self.cancel_bnt)
self.cancel_bnt.connect("clicked", self.on_cancel_button_clicked)
@@ -599,6 +751,9 @@
def on_cancel_button_clicked(self, obj):
self.users.destroy()
+ def on_help_button_clicked(self, obj):
+ print "on_help_button_clicked"
+
def on_back_button_clicked(self, obj):
if self.notebook.get_current_page() == 1:
self.notebook.set_current_page(0)
@@ -616,7 +771,6 @@
def on_apply_bnt_clicked(self, obj):
data = self.get_new_data()
password = self.xml.get_object("password_entry_1").get_text()
- self.users.destroy()
user = User(nick=data['nick'],
full_name=data['full_name'],
@@ -638,6 +792,20 @@
self.users_manager.insert(user)
+ #Avatar
+ try:
+ avatar_pixbuf = self.user_avatar_image.get_pixbuf()
+ except ValueError:
+ avatar_pixbuf = None
+
+ if self.user_avatar and avatar_pixbuf:
+ path = get_user_avatar_path(user.id)
+
+ try:
+ avatar_pixbuf.save(path, "jpeg", {"quality":"100"})
+ except Exception, error:
+ print error
+
if value:
#Insert Entry in Cash Flow
lctime = localtime()
@@ -652,8 +820,10 @@
citem.day = lctime[2]
citem.hour = current_hour
- self.cash_flow_manager.insert(citem)
+ self.cash_flow_manager.insert(citem)
+ self.users.destroy()
+
def on_show_password_toggle_toggled(self, obj):
status = obj.get_active()
self.xml.get_object("password_entry_1").set_visibility(status)
Modified: trunk/openlh-server/src/OpenlhServer/ui/main.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/ui/main.py 2008-10-15 20:07:49 UTC (rev 307)
+++ trunk/openlh-server/src/OpenlhServer/ui/main.py 2008-10-16 20:03:22 UTC (rev 308)
@@ -23,6 +23,7 @@
import datetime
from time import localtime
+from os import remove as os_remove
from OpenlhServer.ui.plugins import PluginsWindow
@@ -30,6 +31,7 @@
from OpenlhServer.ui import DateEdit, tray, icons, dialogs, treeview, prefs
from OpenlhServer.ui.SearchEntry import SearchEntry
from OpenlhServer.utils import md5_cripto, get_gtk_builder
+from OpenlhServer.utils import user_has_avatar, get_user_avatar_path
from OpenlhServer.db.models import CashFlowItem, User
from OpenlhServer.globals import *
_ = gettext.gettext
@@ -578,6 +580,13 @@
Parent=self.mainwindow)
if d.response:
+ #Remove Avatar File
+ if user_has_avatar(user.id):
+ try:
+ os_remove(get_user_avatar_path(user.id))
+ except Exception , e:
+ print str(e)
+
self.users_manager.delete(user)
def block_machine_clicked(self, obj):
Modified: trunk/openlh-server/src/OpenlhServer/utils.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/utils.py 2008-10-15 20:07:49 UTC (rev 307)
+++ trunk/openlh-server/src/OpenlhServer/utils.py 2008-10-16 20:03:22 UTC (rev 308)
@@ -381,4 +381,13 @@
assert os.path.exists(filename)
b = Builder()
b.add_from_file(filename)
- return b
\ No newline at end of file
+ return b
+
+def get_user_avatar_path(user_id):
+ """
+ Get the avatar path for the user
+ """
+ return os.path.join(AVATARS_PATH, "%d.jpeg" % user_id)
+
+def user_has_avatar(user_id):
+ return os.path.exists(get_user_avatar_path(user_id))
\ No newline at end of file
Modified: trunk/openlh-server/src/openlh-server
===================================================================
--- trunk/openlh-server/src/openlh-server 2008-10-15 20:07:49 UTC (rev 307)
+++ trunk/openlh-server/src/openlh-server 2008-10-16 20:03:22 UTC (rev 308)
@@ -114,6 +114,11 @@
sys.exit(3)
CONFIG_PATH_EXISTS = os.path.exists(CONFIG_PATH)
+
+#Check Avatars Path
+if not os.path.exists(AVATARS_PATH):
+ mkdir(AVATARS_PATH)
+
pid_dir = os.path.dirname(SERVER_PID_FILE)
if not os.path.exists(pid_dir):
mkdir(pid_dir)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-15 20:07:53
|
Revision: 307
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=307&view=rev
Author: n3rd3x
Date: 2008-10-15 20:07:49 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/openlh-server/src/OpenlhServer/ui/plugins.py
Modified: trunk/openlh-server/src/OpenlhServer/ui/plugins.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/ui/plugins.py 2008-10-15 19:50:59 UTC (rev 306)
+++ trunk/openlh-server/src/OpenlhServer/ui/plugins.py 2008-10-15 20:07:49 UTC (rev 307)
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
#
# 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
@@ -154,7 +154,6 @@
model[path][1] = not model[path][1]
def on_preferences_clicked(self, obj):
- self.clear_entries()
if len(self.ListStore) > 0:
model_ = self.ListStore
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-15 19:51:08
|
Revision: 306
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=306&view=rev
Author: n3rd3x
Date: 2008-10-15 19:50:59 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
UTF8 File Fixes
Modified Paths:
--------------
trunk/openlh-server/src/OpenlhServer/plugins/example/__init__.py
Modified: trunk/openlh-server/src/OpenlhServer/plugins/example/__init__.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/plugins/example/__init__.py 2008-10-15 19:32:44 UTC (rev 305)
+++ trunk/openlh-server/src/OpenlhServer/plugins/example/__init__.py 2008-10-15 19:50:59 UTC (rev 306)
@@ -1,8 +1,8 @@
PLUGIN_NAME = "Example"
PLUGIN_DESCRIPTION = "Plugin Example"
-PLUGIN_AUTHOR = "Wilson Pinto J\xFAnior <wi...@op...>"
-PLUGIN_COPYRIGHT = "Copyright 2008 Wilson Pinto J\xFAnior"
+PLUGIN_AUTHOR = "Wilson Pinto Júnior <wi...@op...>"
+PLUGIN_COPYRIGHT = "Copyright 2008 Wilson Pinto Júnior"
PLUGIN_SITE = "http://openlanhouse.org"
def enable(daemon, main_window):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-15 19:32:56
|
Revision: 305
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=305&view=rev
Author: n3rd3x
Date: 2008-10-15 19:32:44 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/TODO
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-10-15 19:26:38 UTC (rev 304)
+++ trunk/TODO 2008-10-15 19:32:44 UTC (rev 305)
@@ -14,7 +14,7 @@
- maybe works in windows
- Add price per machine category
- Improvements in translations
- - Add a system of plugins
+ - Add a system of plugins (done)
- System configuration per machine category
- More compatibility with gnome hig!
- Remove python-certtool dependency and use certtool binary.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-14 17:30:33
|
Revision: 303
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=303&view=rev
Author: n3rd3x
Date: 2008-10-14 17:30:21 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
TODO: an item is done
Modified Paths:
--------------
trunk/openlh-server/TODO
Added Paths:
-----------
trunk/TODO
Copied: trunk/TODO (from rev 301, trunk/openlh-server/TODO)
===================================================================
--- trunk/TODO (rev 0)
+++ trunk/TODO 2008-10-14 17:30:21 UTC (rev 303)
@@ -0,0 +1,30 @@
+OpenLanhouse Todo
+=================
+===== For 0.2 release ======
+
+ - Code cleanup
+ - Rewrite the network system, using gnutls and glib
+ - Add post-paid and before-paid system
+ - Write a very well documentation
+ - Shutdown and reboot remotely (call gdm or kdm)
+ - Write a ticket system
+ - Other OpenDebts works!
+ - Add a new bugtracker (done)
+ - maybe migrate to git
+ - maybe works in windows
+ - Add price per machine category
+ - Improvements in translations
+ - Add a system of plugins
+ - System configuration per machine category
+ - More compatibility with gnome hig!
+ - Remove python-certtool dependency and use certtool binary.
+
+ ==== * Starting project * ====
+
+ * Create a full structure of files to follow the gnu coding standards:
+
+ - http://www.gnu.org/prep/standards/standards.html#Making releases
+
+ * Will code pretty to hack the world!
+
+ * Write a right README file!
Property changes on: trunk/TODO
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/openlh-server/TODO
===================================================================
--- trunk/openlh-server/TODO 2008-10-14 17:20:50 UTC (rev 302)
+++ trunk/openlh-server/TODO 2008-10-14 17:30:21 UTC (rev 303)
@@ -9,7 +9,7 @@
- Shutdown and reboot remotely (call gdm or kdm)
- Write a ticket system
- Other OpenDebts works!
- - Add a new bugtracker
+ - Add a new bugtracker (done)
- maybe migrate to git
- maybe works in windows
- Add price per machine category
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-14 17:21:10
|
Revision: 302
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=302&view=rev
Author: n3rd3x
Date: 2008-10-14 17:20:50 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
* Replaced all headers in client.py by header constansts
Modified Paths:
--------------
trunk/openlh-core/src/OpenlhCore/net/client.py
Modified: trunk/openlh-core/src/OpenlhCore/net/client.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/client.py 2008-10-14 16:39:04 UTC (rev 301)
+++ trunk/openlh-core/src/OpenlhCore/net/client.py 2008-10-14 17:20:50 UTC (rev 302)
@@ -368,11 +368,11 @@
xmlout = xmlpickler_dumps(params, method)
size = len(xmlout)
- head = "-----BEGIN XMLREQUEST ID=%d SIZE=%d-----" % (self.currid, size)
+ head = BEGIN_XMLREQUEST_HEADER % (self.currid, size)
self.send_lock.acquire()
self.session.send(head)
self.session.send(xmlout)
- self.session.send("-----END XMLREQUEST-----")
+ self.session.send(END_XMLREQUEST_HEADER)
self.send_lock.release()
@@ -387,15 +387,13 @@
Send Response to peer
"""
- self.logger.info('sending response number %d' % id)
-
try:
output = xmlpickler_dumps((response,), methodresponse=1)
- head = '-----BEGIN XMLRESPONSE ID=%d SIZE=%d-----' % (id, len(output))
+ head = BEGIN_XMLRESPONSE_HEADER % (id, len(output))
self.send_lock.acquire()
self.session.send(head)
self.session.send(output)
- self.session.send("-----END XMLRESPONSE-----")
+ self.session.send(END_XMLRESPONSE_HEADER)
except Exception, error:
self.logger.error(error)
@@ -418,8 +416,7 @@
f = open(filepath)
size = ospath.getsize(filepath)
- head = "-----BEGIN SENDFILE ID=%d METHOD=%s SIZE=%d-----" % (self.currid,
- method, size)
+ head = BEGIN_SENDFILE_HEADER % (self.currid, method, size)
self.currid += 1
self.send_lock.acquire()
@@ -434,7 +431,7 @@
else:
break
- self.session.send("-----END SENDFILE-----")
+ self.session.send(END_SENDFILE_HEADER)
self.logger.info('Done: File sent %s to server' % filepath)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-14 16:39:21
|
Revision: 301
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=301&view=rev
Author: n3rd3x
Date: 2008-10-14 16:39:04 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/openlh-client/debian/control
trunk/openlh-server/debian/control
Modified: trunk/openlh-client/debian/control
===================================================================
--- trunk/openlh-client/debian/control 2008-10-13 18:47:01 UTC (rev 300)
+++ trunk/openlh-client/debian/control 2008-10-14 16:39:04 UTC (rev 301)
@@ -2,7 +2,7 @@
Section: gnome
Priority: extra
Maintainer: Wilson Pinto Júnior <wi...@op...>
-Build-Depends: debhelper (>= 6), autotools-dev, libpanel-applet2-dev, dbus-glib-1-dev,
+Build-Depends: debhelper (>= 6), autotools-dev, libpanel-applet2-dev, libdbus-glib-1-dev,
Standards-Version: 3.7.3
Homepage: http://openlanhouse.org
Modified: trunk/openlh-server/debian/control
===================================================================
--- trunk/openlh-server/debian/control 2008-10-13 18:47:01 UTC (rev 300)
+++ trunk/openlh-server/debian/control 2008-10-14 16:39:04 UTC (rev 301)
@@ -8,5 +8,5 @@
Package: openlh-server
Architecture: i386
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, python-gnome2, python-gtk2, python-certtool, python-gnutls, python-sqlalchemy
Description: a LAN House and Cyber Caffe Manager for GNOME Desktop.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-13 18:47:14
|
Revision: 300
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=300&view=rev
Author: n3rd3x
Date: 2008-10-13 18:47:01 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
*openlh-core: rewrite debian files
Modified Paths:
--------------
trunk/openlh-core/debian/changelog
trunk/openlh-core/debian/control
trunk/openlh-core/debian/files
trunk/openlh-core/debian/rules
Added Paths:
-----------
trunk/openlh-core/build_deb_package.sh
trunk/openlh-core/debian/openlh-core.substvars
Removed Paths:
-------------
trunk/openlh-core/debian/menu
trunk/openlh-core/debian/openlh-server.substvars
Copied: trunk/openlh-core/build_deb_package.sh (from rev 298, trunk/openlh-client/build_deb_package.sh)
===================================================================
--- trunk/openlh-core/build_deb_package.sh (rev 0)
+++ trunk/openlh-core/build_deb_package.sh 2008-10-13 18:47:01 UTC (rev 300)
@@ -0,0 +1,3 @@
+#!/bin/bash
+./autogen.sh $@
+dpkg-buildpackage -rfakeroot
\ No newline at end of file
Property changes on: trunk/openlh-core/build_deb_package.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mergeinfo
+
Modified: trunk/openlh-core/debian/changelog
===================================================================
--- trunk/openlh-core/debian/changelog 2008-10-13 18:41:22 UTC (rev 299)
+++ trunk/openlh-core/debian/changelog 2008-10-13 18:47:01 UTC (rev 300)
@@ -1,4 +1,4 @@
-openlh-server (0.1-1) unstable; urgency=low
+openlh-core (0.1-1) unstable; urgency=low
* Initial release from upstream
Modified: trunk/openlh-core/debian/control
===================================================================
--- trunk/openlh-core/debian/control 2008-10-13 18:41:22 UTC (rev 299)
+++ trunk/openlh-core/debian/control 2008-10-13 18:47:01 UTC (rev 300)
@@ -1,4 +1,4 @@
-Source: openlh-server
+Source: openlh-core
Section: gnome
Priority: extra
Maintainer: Wilson Pinto J\xFAnior <wi...@op...>
@@ -6,7 +6,7 @@
Standards-Version: 3.7.3
Homepage: http://openlanhouse.org
-Package: openlh-server
+Package: openlh-core
Architecture: i386
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: a LAN House and Cyber Caffe Manager for GNOME Desktop.
+Depends: ${shlibs:Depends}, ${misc:Depends}, python-gnutls
+Description: Core libs to OpenLanhouse.
Modified: trunk/openlh-core/debian/files
===================================================================
--- trunk/openlh-core/debian/files 2008-10-13 18:41:22 UTC (rev 299)
+++ trunk/openlh-core/debian/files 2008-10-13 18:47:01 UTC (rev 300)
@@ -1 +1 @@
-openlh-server_0.1-1_i386.deb gnome extra
+openlh-core_0.1-1_i386.deb gnome extra
Deleted: trunk/openlh-core/debian/menu
===================================================================
--- trunk/openlh-core/debian/menu 2008-10-13 18:41:22 UTC (rev 299)
+++ trunk/openlh-core/debian/menu 2008-10-13 18:47:01 UTC (rev 300)
@@ -1,6 +0,0 @@
-?package(openlh-server): \
- needs="wm" \
- section="Applications/Network" \
- title="OpenLanhouse Server" \
- icon="openlh-server.png" \
- command="/usr/bin/openlh-server"
Copied: trunk/openlh-core/debian/openlh-core.substvars (from rev 296, trunk/openlh-core/debian/openlh-server.substvars)
===================================================================
--- trunk/openlh-core/debian/openlh-core.substvars (rev 0)
+++ trunk/openlh-core/debian/openlh-core.substvars 2008-10-13 18:47:01 UTC (rev 300)
@@ -0,0 +1,2 @@
+python:Depends=python (<< 2.6), python (>= 2.5)
+misc:Depends=python-gnome2, python-gtk2, python-certtool, python-gnutls, python-sqlalchemy
Property changes on: trunk/openlh-core/debian/openlh-core.substvars
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: trunk/openlh-core/debian/openlh-server.substvars
===================================================================
--- trunk/openlh-core/debian/openlh-server.substvars 2008-10-13 18:41:22 UTC (rev 299)
+++ trunk/openlh-core/debian/openlh-server.substvars 2008-10-13 18:47:01 UTC (rev 300)
@@ -1,2 +0,0 @@
-python:Depends=python (<< 2.6), python (>= 2.5)
-misc:Depends=python-gnome2, python-gtk2, python-certtool, python-gnutls, python-sqlalchemy
Modified: trunk/openlh-core/debian/rules
===================================================================
--- trunk/openlh-core/debian/rules 2008-10-13 18:41:22 UTC (rev 299)
+++ trunk/openlh-core/debian/rules 2008-10-13 18:47:01 UTC (rev 300)
@@ -61,8 +61,8 @@
dh_clean -k
dh_installdirs
- # Add here commands to install the package into debian/openlh-server.
- $(MAKE) DESTDIR=$(CURDIR)/debian/openlh-server install
+ # Add here commands to install the package into debian/openlh-core.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/openlh-core install
# Build architecture-independent files here.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-13 18:41:33
|
Revision: 299
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=299&view=rev
Author: n3rd3x
Date: 2008-10-13 18:41:22 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
* dh_make fixes
Modified Paths:
--------------
trunk/openlh-client/debian/control
trunk/openlh-client/debian/files
Added Paths:
-----------
trunk/openlh-client/debian/openlh-client.substvars
Removed Paths:
-------------
trunk/openlh-client/debian/openlh-server.substvars
Modified: trunk/openlh-client/debian/control
===================================================================
--- trunk/openlh-client/debian/control 2008-10-13 17:34:57 UTC (rev 298)
+++ trunk/openlh-client/debian/control 2008-10-13 18:41:22 UTC (rev 299)
@@ -2,11 +2,11 @@
Section: gnome
Priority: extra
Maintainer: Wilson Pinto Júnior <wi...@op...>
-Build-Depends: debhelper (>= 6), autotools-dev
+Build-Depends: debhelper (>= 6), autotools-dev, libpanel-applet2-dev, dbus-glib-1-dev,
Standards-Version: 3.7.3
Homepage: http://openlanhouse.org
Package: openlh-client
Architecture: i386
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, python-gnome2, python-gtk2, python-certtool, python-gnutls, python-dbus
Description: a LAN House and Cyber Caffe Client for GNOME Desktop.
Modified: trunk/openlh-client/debian/files
===================================================================
--- trunk/openlh-client/debian/files 2008-10-13 17:34:57 UTC (rev 298)
+++ trunk/openlh-client/debian/files 2008-10-13 18:41:22 UTC (rev 299)
@@ -1 +1 @@
-openlh-server_0.1-1_i386.deb gnome extra
+openlh-client_0.1-1_i386.deb gnome extra
Added: trunk/openlh-client/debian/openlh-client.substvars
===================================================================
--- trunk/openlh-client/debian/openlh-client.substvars (rev 0)
+++ trunk/openlh-client/debian/openlh-client.substvars 2008-10-13 18:41:22 UTC (rev 299)
@@ -0,0 +1,3 @@
+python:Depends=python (<< 2.6), python (>= 2.5)
+misc:Depends=gconf2 (>= 2.10.1-2)
+shlibs:Depends=libart-2.0-2 (>= 2.3.18), libatk1.0-0 (>= 1.20.0), libbonobo2-0 (>= 2.15.0), libbonoboui2-0 (>= 2.15.1), libc6 (>= 2.7-1), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 1.0.2), libdbus-glib-1-2 (>= 0.71), libgconf2-4 (>= 2.13.5), libglib2.0-0 (>= 2.16.0), libgnome2-0 (>= 2.17.3), libgnomecanvas2-0 (>= 2.11.1), libgnomeui-0 (>= 2.17.1), libgnomevfs2-0 (>= 1:2.17.90), libgtk2.0-0 (>= 2.12.0), libice6 (>= 1:1.0.0), liborbit2 (>= 1:2.14.10), libpanel-applet2-0 (>= 2.19.3), libpango1.0-0 (>= 1.20.3), libpopt0 (>= 1.14), libsm6
Deleted: trunk/openlh-client/debian/openlh-server.substvars
===================================================================
--- trunk/openlh-client/debian/openlh-server.substvars 2008-10-13 17:34:57 UTC (rev 298)
+++ trunk/openlh-client/debian/openlh-server.substvars 2008-10-13 18:41:22 UTC (rev 299)
@@ -1,2 +0,0 @@
-python:Depends=python (<< 2.6), python (>= 2.5)
-misc:Depends=python-gnome2, python-gtk2, python-certtool, python-gnutls, python-sqlalchemy
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-13 17:35:09
|
Revision: 298
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=298&view=rev
Author: n3rd3x
Date: 2008-10-13 17:34:57 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/openlh-client/debian/changelog
trunk/openlh-client/debian/control
trunk/openlh-client/debian/menu
trunk/openlh-client/debian/rules
Added Paths:
-----------
trunk/openlh-client/build_deb_package.sh
Added: trunk/openlh-client/build_deb_package.sh
===================================================================
--- trunk/openlh-client/build_deb_package.sh (rev 0)
+++ trunk/openlh-client/build_deb_package.sh 2008-10-13 17:34:57 UTC (rev 298)
@@ -0,0 +1,3 @@
+#!/bin/bash
+./autogen.sh $@
+dpkg-buildpackage -rfakeroot
\ No newline at end of file
Property changes on: trunk/openlh-client/build_deb_package.sh
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/openlh-client/debian/changelog
===================================================================
--- trunk/openlh-client/debian/changelog 2008-10-13 17:22:44 UTC (rev 297)
+++ trunk/openlh-client/debian/changelog 2008-10-13 17:34:57 UTC (rev 298)
@@ -1,4 +1,4 @@
-openlh-server (0.1-1) unstable; urgency=low
+openlh-client (0.1-1) unstable; urgency=low
* Initial release from upstream
Modified: trunk/openlh-client/debian/control
===================================================================
--- trunk/openlh-client/debian/control 2008-10-13 17:22:44 UTC (rev 297)
+++ trunk/openlh-client/debian/control 2008-10-13 17:34:57 UTC (rev 298)
@@ -1,12 +1,12 @@
-Source: openlh-server
+Source: openlh-client
Section: gnome
Priority: extra
-Maintainer: Wilson Pinto J\xFAnior <wi...@op...>
+Maintainer: Wilson Pinto Júnior <wi...@op...>
Build-Depends: debhelper (>= 6), autotools-dev
Standards-Version: 3.7.3
Homepage: http://openlanhouse.org
-Package: openlh-server
+Package: openlh-client
Architecture: i386
Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: a LAN House and Cyber Caffe Manager for GNOME Desktop.
+Description: a LAN House and Cyber Caffe Client for GNOME Desktop.
Modified: trunk/openlh-client/debian/menu
===================================================================
--- trunk/openlh-client/debian/menu 2008-10-13 17:22:44 UTC (rev 297)
+++ trunk/openlh-client/debian/menu 2008-10-13 17:34:57 UTC (rev 298)
@@ -1,6 +1,6 @@
-?package(openlh-server): \
+?package(openlh-client): \
needs="wm" \
section="Applications/Network" \
- title="OpenLanhouse Server" \
- icon="openlh-server.png" \
- command="/usr/bin/openlh-server"
+ title="OpenLanhouse Client" \
+ icon="openlh-client.png" \
+ command="/usr/bin/openlh-client"
Modified: trunk/openlh-client/debian/rules
===================================================================
--- trunk/openlh-client/debian/rules 2008-10-13 17:22:44 UTC (rev 297)
+++ trunk/openlh-client/debian/rules 2008-10-13 17:34:57 UTC (rev 298)
@@ -61,8 +61,8 @@
dh_clean -k
dh_installdirs
- # Add here commands to install the package into debian/openlh-server.
- $(MAKE) DESTDIR=$(CURDIR)/debian/openlh-server install
+ # Add here commands to install the package into debian/openlh-client.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/openlh-client install
# Build architecture-independent files here.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-13 17:22:52
|
Revision: 297
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=297&view=rev
Author: n3rd3x
Date: 2008-10-13 17:22:44 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
* fixes in build debian package
Modified Paths:
--------------
trunk/openlh-server/INSTALL
trunk/openlh-server/configure.ac
trunk/openlh-server/debian/openlh-server.substvars
trunk/openlh-server/src/OpenlhServer/Makefile.am
Added Paths:
-----------
trunk/openlh-server/build_deb_package.sh
Modified: trunk/openlh-server/INSTALL
===================================================================
--- trunk/openlh-server/INSTALL 2008-10-13 17:12:34 UTC (rev 296)
+++ trunk/openlh-server/INSTALL 2008-10-13 17:22:44 UTC (rev 297)
@@ -1,9 +1,10 @@
Installation Instructions
*************************
-Copyright (C) 2006, 2007 Wilson N3RD3X <n3...@li...>
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
-This file is free documentation; the Free Software Foundatin gives
+This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
@@ -66,6 +67,9 @@
all sorts of other programs in order to regenerate files that came
with the distribution.
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
Compilers and Options
=====================
Added: trunk/openlh-server/build_deb_package.sh
===================================================================
--- trunk/openlh-server/build_deb_package.sh (rev 0)
+++ trunk/openlh-server/build_deb_package.sh 2008-10-13 17:22:44 UTC (rev 297)
@@ -0,0 +1,3 @@
+#!/bin/bash
+./autogen.sh $@
+dpkg-buildpackage -rfakeroot
\ No newline at end of file
Modified: trunk/openlh-server/configure.ac
===================================================================
--- trunk/openlh-server/configure.ac 2008-10-13 17:12:34 UTC (rev 296)
+++ trunk/openlh-server/configure.ac 2008-10-13 17:22:44 UTC (rev 297)
@@ -123,12 +123,12 @@
data/openlh-server.desktop.in
data/glade/Makefile
data/ui/Makefile
-data/db/Makefile
data/icons/Makefile
data/icons/status/Makefile
src/Makefile
src/OpenlhServer/Makefile
src/OpenlhServer/ui/Makefile
+src/OpenlhServer/db/Makefile
src/OpenlhServer/config.py
po/Makefile.in
])
Modified: trunk/openlh-server/debian/openlh-server.substvars
===================================================================
--- trunk/openlh-server/debian/openlh-server.substvars 2008-10-13 17:12:34 UTC (rev 296)
+++ trunk/openlh-server/debian/openlh-server.substvars 2008-10-13 17:22:44 UTC (rev 297)
@@ -1,2 +1,2 @@
python:Depends=python (<< 2.6), python (>= 2.5)
-misc:Depends=python-gnome2, python-gtk2, python-certtool, python-gnutls, python-sqlalchemy
+misc:Depends=gconf2 (>= 2.10.1-2)
Modified: trunk/openlh-server/src/OpenlhServer/Makefile.am
===================================================================
--- trunk/openlh-server/src/OpenlhServer/Makefile.am 2008-10-13 17:12:34 UTC (rev 296)
+++ trunk/openlh-server/src/OpenlhServer/Makefile.am 2008-10-13 17:22:44 UTC (rev 297)
@@ -1,4 +1,4 @@
-SUBDIRS = ui db net
+SUBDIRS = ui db
openlhdir = $(pythondir)/OpenlhServer
openlh_PYTHON = \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-13 17:12:45
|
Revision: 296
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=296&view=rev
Author: n3rd3x
Date: 2008-10-13 17:12:34 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
* Added a debian directory in all packages
Added Paths:
-----------
trunk/openlh-client/debian/
trunk/openlh-client/debian/changelog
trunk/openlh-client/debian/compat
trunk/openlh-client/debian/control
trunk/openlh-client/debian/copyright
trunk/openlh-client/debian/dirs
trunk/openlh-client/debian/docs
trunk/openlh-client/debian/files
trunk/openlh-client/debian/menu
trunk/openlh-client/debian/openlh-server.substvars
trunk/openlh-client/debian/rules
trunk/openlh-core/debian/
trunk/openlh-core/debian/changelog
trunk/openlh-core/debian/compat
trunk/openlh-core/debian/control
trunk/openlh-core/debian/copyright
trunk/openlh-core/debian/dirs
trunk/openlh-core/debian/docs
trunk/openlh-core/debian/files
trunk/openlh-core/debian/menu
trunk/openlh-core/debian/openlh-server.substvars
trunk/openlh-core/debian/rules
trunk/openlh-server/debian/
trunk/openlh-server/debian/changelog
trunk/openlh-server/debian/compat
trunk/openlh-server/debian/control
trunk/openlh-server/debian/copyright
trunk/openlh-server/debian/dirs
trunk/openlh-server/debian/docs
trunk/openlh-server/debian/files
trunk/openlh-server/debian/menu
trunk/openlh-server/debian/openlh-server.substvars
trunk/openlh-server/debian/rules
Added: trunk/openlh-client/debian/changelog
===================================================================
--- trunk/openlh-client/debian/changelog (rev 0)
+++ trunk/openlh-client/debian/changelog 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,6 @@
+openlh-server (0.1-1) unstable; urgency=low
+
+ * Initial release from upstream
+
+ -- Wilson Pinto J\xFAnior <wi...@op...> Mon, 13 Oct 2008 13:01:50 -0200
+
Added: trunk/openlh-client/debian/compat
===================================================================
--- trunk/openlh-client/debian/compat (rev 0)
+++ trunk/openlh-client/debian/compat 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+6
Added: trunk/openlh-client/debian/control
===================================================================
--- trunk/openlh-client/debian/control (rev 0)
+++ trunk/openlh-client/debian/control 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,12 @@
+Source: openlh-server
+Section: gnome
+Priority: extra
+Maintainer: Wilson Pinto J\xFAnior <wi...@op...>
+Build-Depends: debhelper (>= 6), autotools-dev
+Standards-Version: 3.7.3
+Homepage: http://openlanhouse.org
+
+Package: openlh-server
+Architecture: i386
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: a LAN House and Cyber Caffe Manager for GNOME Desktop.
Added: trunk/openlh-client/debian/copyright
===================================================================
--- trunk/openlh-client/debian/copyright (rev 0)
+++ trunk/openlh-client/debian/copyright 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,34 @@
+This package was debianized by Wilson Pinto J\xFAnior
+<wi...@op...> on Tue, 03 Jun 2008 04:09:48 -0300.
+
+It was downloaded from http://openlanhouse.org/releases/
+
+Upstream Authors
+
+ Wilson Pinto J\xFAnior <wi...@op...>
+
+Copyright:
+
+ Wilson Pinto J\xFAnior <wi...@op...>
+
+License:
+
+ This package 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 package 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 package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2008, Wilson Pinto J\xFAnior
+<wi...@op...> and is licensed under the GPL, see above.
Added: trunk/openlh-client/debian/dirs
===================================================================
--- trunk/openlh-client/debian/dirs (rev 0)
+++ trunk/openlh-client/debian/dirs 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+usr/bin
Added: trunk/openlh-client/debian/docs
===================================================================
--- trunk/openlh-client/debian/docs (rev 0)
+++ trunk/openlh-client/debian/docs 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,3 @@
+NEWS
+README
+TODO
Added: trunk/openlh-client/debian/files
===================================================================
--- trunk/openlh-client/debian/files (rev 0)
+++ trunk/openlh-client/debian/files 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+openlh-server_0.1-1_i386.deb gnome extra
Added: trunk/openlh-client/debian/menu
===================================================================
--- trunk/openlh-client/debian/menu (rev 0)
+++ trunk/openlh-client/debian/menu 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,6 @@
+?package(openlh-server): \
+ needs="wm" \
+ section="Applications/Network" \
+ title="OpenLanhouse Server" \
+ icon="openlh-server.png" \
+ command="/usr/bin/openlh-server"
Added: trunk/openlh-client/debian/openlh-server.substvars
===================================================================
--- trunk/openlh-client/debian/openlh-server.substvars (rev 0)
+++ trunk/openlh-client/debian/openlh-server.substvars 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,2 @@
+python:Depends=python (<< 2.6), python (>= 2.5)
+misc:Depends=python-gnome2, python-gtk2, python-certtool, python-gnutls, python-sqlalchemy
Added: trunk/openlh-client/debian/rules
===================================================================
--- trunk/openlh-client/debian/rules (rev 0)
+++ trunk/openlh-client/debian/rules 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,105 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+else
+CROSS= --build $(DEB_BUILD_GNU_TYPE)
+endif
+
+
+
+config.status: configure
+ dh_testdir
+ # Add here commands to configure the package.
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+ cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+ cp -f /usr/share/misc/config.guess config.guess
+endif
+ ./configure $(CROSS) --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ [ ! -f Makefile ] || $(MAKE) distclean
+ rm -f config.sub config.guess
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/openlh-server.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/openlh-server install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_installexamples
+# dh_install
+ dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+ dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_gconf
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Property changes on: trunk/openlh-client/debian/rules
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/openlh-core/debian/changelog
===================================================================
--- trunk/openlh-core/debian/changelog (rev 0)
+++ trunk/openlh-core/debian/changelog 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,6 @@
+openlh-server (0.1-1) unstable; urgency=low
+
+ * Initial release from upstream
+
+ -- Wilson Pinto J\xFAnior <wi...@op...> Mon, 13 Oct 2008 13:01:50 -0200
+
Added: trunk/openlh-core/debian/compat
===================================================================
--- trunk/openlh-core/debian/compat (rev 0)
+++ trunk/openlh-core/debian/compat 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+6
Added: trunk/openlh-core/debian/control
===================================================================
--- trunk/openlh-core/debian/control (rev 0)
+++ trunk/openlh-core/debian/control 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,12 @@
+Source: openlh-server
+Section: gnome
+Priority: extra
+Maintainer: Wilson Pinto J\xFAnior <wi...@op...>
+Build-Depends: debhelper (>= 6), autotools-dev
+Standards-Version: 3.7.3
+Homepage: http://openlanhouse.org
+
+Package: openlh-server
+Architecture: i386
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: a LAN House and Cyber Caffe Manager for GNOME Desktop.
Added: trunk/openlh-core/debian/copyright
===================================================================
--- trunk/openlh-core/debian/copyright (rev 0)
+++ trunk/openlh-core/debian/copyright 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,34 @@
+This package was debianized by Wilson Pinto J\xFAnior
+<wi...@op...> on Tue, 03 Jun 2008 04:09:48 -0300.
+
+It was downloaded from http://openlanhouse.org/releases/
+
+Upstream Authors
+
+ Wilson Pinto J\xFAnior <wi...@op...>
+
+Copyright:
+
+ Wilson Pinto J\xFAnior <wi...@op...>
+
+License:
+
+ This package 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 package 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 package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2008, Wilson Pinto J\xFAnior
+<wi...@op...> and is licensed under the GPL, see above.
Added: trunk/openlh-core/debian/dirs
===================================================================
--- trunk/openlh-core/debian/dirs (rev 0)
+++ trunk/openlh-core/debian/dirs 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+usr/bin
Added: trunk/openlh-core/debian/docs
===================================================================
--- trunk/openlh-core/debian/docs (rev 0)
+++ trunk/openlh-core/debian/docs 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,3 @@
+NEWS
+README
+TODO
Added: trunk/openlh-core/debian/files
===================================================================
--- trunk/openlh-core/debian/files (rev 0)
+++ trunk/openlh-core/debian/files 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+openlh-server_0.1-1_i386.deb gnome extra
Added: trunk/openlh-core/debian/menu
===================================================================
--- trunk/openlh-core/debian/menu (rev 0)
+++ trunk/openlh-core/debian/menu 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,6 @@
+?package(openlh-server): \
+ needs="wm" \
+ section="Applications/Network" \
+ title="OpenLanhouse Server" \
+ icon="openlh-server.png" \
+ command="/usr/bin/openlh-server"
Added: trunk/openlh-core/debian/openlh-server.substvars
===================================================================
--- trunk/openlh-core/debian/openlh-server.substvars (rev 0)
+++ trunk/openlh-core/debian/openlh-server.substvars 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,2 @@
+python:Depends=python (<< 2.6), python (>= 2.5)
+misc:Depends=python-gnome2, python-gtk2, python-certtool, python-gnutls, python-sqlalchemy
Added: trunk/openlh-core/debian/rules
===================================================================
--- trunk/openlh-core/debian/rules (rev 0)
+++ trunk/openlh-core/debian/rules 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,105 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+else
+CROSS= --build $(DEB_BUILD_GNU_TYPE)
+endif
+
+
+
+config.status: configure
+ dh_testdir
+ # Add here commands to configure the package.
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+ cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+ cp -f /usr/share/misc/config.guess config.guess
+endif
+ ./configure $(CROSS) --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ [ ! -f Makefile ] || $(MAKE) distclean
+ rm -f config.sub config.guess
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/openlh-server.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/openlh-server install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_installexamples
+# dh_install
+ dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+ dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_gconf
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Property changes on: trunk/openlh-core/debian/rules
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/openlh-server/debian/changelog
===================================================================
--- trunk/openlh-server/debian/changelog (rev 0)
+++ trunk/openlh-server/debian/changelog 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,6 @@
+openlh-server (0.1-1) unstable; urgency=low
+
+ * Initial release from upstream
+
+ -- Wilson Pinto J\xFAnior <wi...@op...> Mon, 13 Oct 2008 13:01:50 -0200
+
Added: trunk/openlh-server/debian/compat
===================================================================
--- trunk/openlh-server/debian/compat (rev 0)
+++ trunk/openlh-server/debian/compat 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+6
Added: trunk/openlh-server/debian/control
===================================================================
--- trunk/openlh-server/debian/control (rev 0)
+++ trunk/openlh-server/debian/control 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,12 @@
+Source: openlh-server
+Section: gnome
+Priority: extra
+Maintainer: Wilson Pinto J\xFAnior <wi...@op...>
+Build-Depends: debhelper (>= 6), autotools-dev
+Standards-Version: 3.7.3
+Homepage: http://openlanhouse.org
+
+Package: openlh-server
+Architecture: i386
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: a LAN House and Cyber Caffe Manager for GNOME Desktop.
Added: trunk/openlh-server/debian/copyright
===================================================================
--- trunk/openlh-server/debian/copyright (rev 0)
+++ trunk/openlh-server/debian/copyright 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,34 @@
+This package was debianized by Wilson Pinto J\xFAnior
+<wi...@op...> on Tue, 03 Jun 2008 04:09:48 -0300.
+
+It was downloaded from http://openlanhouse.org/releases/
+
+Upstream Authors
+
+ Wilson Pinto J\xFAnior <wi...@op...>
+
+Copyright:
+
+ Wilson Pinto J\xFAnior <wi...@op...>
+
+License:
+
+ This package 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 package 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 package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2008, Wilson Pinto J\xFAnior
+<wi...@op...> and is licensed under the GPL, see above.
Added: trunk/openlh-server/debian/dirs
===================================================================
--- trunk/openlh-server/debian/dirs (rev 0)
+++ trunk/openlh-server/debian/dirs 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+usr/bin
Added: trunk/openlh-server/debian/docs
===================================================================
--- trunk/openlh-server/debian/docs (rev 0)
+++ trunk/openlh-server/debian/docs 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,3 @@
+NEWS
+README
+TODO
Added: trunk/openlh-server/debian/files
===================================================================
--- trunk/openlh-server/debian/files (rev 0)
+++ trunk/openlh-server/debian/files 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1 @@
+openlh-server_0.1-1_i386.deb gnome extra
Added: trunk/openlh-server/debian/menu
===================================================================
--- trunk/openlh-server/debian/menu (rev 0)
+++ trunk/openlh-server/debian/menu 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,6 @@
+?package(openlh-server): \
+ needs="wm" \
+ section="Applications/Network" \
+ title="OpenLanhouse Server" \
+ icon="openlh-server.png" \
+ command="/usr/bin/openlh-server"
Added: trunk/openlh-server/debian/openlh-server.substvars
===================================================================
--- trunk/openlh-server/debian/openlh-server.substvars (rev 0)
+++ trunk/openlh-server/debian/openlh-server.substvars 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,2 @@
+python:Depends=python (<< 2.6), python (>= 2.5)
+misc:Depends=python-gnome2, python-gtk2, python-certtool, python-gnutls, python-sqlalchemy
Added: trunk/openlh-server/debian/rules
===================================================================
--- trunk/openlh-server/debian/rules (rev 0)
+++ trunk/openlh-server/debian/rules 2008-10-13 17:12:34 UTC (rev 296)
@@ -0,0 +1,105 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+else
+CROSS= --build $(DEB_BUILD_GNU_TYPE)
+endif
+
+
+
+config.status: configure
+ dh_testdir
+ # Add here commands to configure the package.
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+ cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+ cp -f /usr/share/misc/config.guess config.guess
+endif
+ ./configure $(CROSS) --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ [ ! -f Makefile ] || $(MAKE) distclean
+ rm -f config.sub config.guess
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/openlh-server.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/openlh-server install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_installexamples
+# dh_install
+ dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+ dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_gconf
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Property changes on: trunk/openlh-server/debian/rules
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-11 19:24:34
|
Revision: 295
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=295&view=rev
Author: n3rd3x
Date: 2008-10-11 19:24:28 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
* removed OpenlhClient/network.py
Modified Paths:
--------------
trunk/openlh-client/src/OpenlhClient/Makefile.am
trunk/openlh-client/src/OpenlhClient/__init__.py
Removed Paths:
-------------
trunk/openlh-client/src/OpenlhClient/network.py
Modified: trunk/openlh-client/src/OpenlhClient/Makefile.am
===================================================================
--- trunk/openlh-client/src/OpenlhClient/Makefile.am 2008-10-11 19:21:16 UTC (rev 294)
+++ trunk/openlh-client/src/OpenlhClient/Makefile.am 2008-10-11 19:24:28 UTC (rev 295)
@@ -7,7 +7,6 @@
login.py \
globals.py \
main.py \
- network.py \
utils.py \
xmlpickler.py \
config.py \
Modified: trunk/openlh-client/src/OpenlhClient/__init__.py
===================================================================
--- trunk/openlh-client/src/OpenlhClient/__init__.py 2008-10-11 19:21:16 UTC (rev 294)
+++ trunk/openlh-client/src/OpenlhClient/__init__.py 2008-10-11 19:24:28 UTC (rev 295)
@@ -17,4 +17,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__all__ = ('login', 'server_info', 'ui', 'config'
- 'globals', 'utils', 'main', 'prefs', 'network', 'dbus_manager')
+ 'globals', 'utils', 'main', 'prefs', 'dbus_manager')
Deleted: trunk/openlh-client/src/OpenlhClient/network.py
===================================================================
--- trunk/openlh-client/src/OpenlhClient/network.py 2008-10-11 19:21:16 UTC (rev 294)
+++ trunk/openlh-client/src/OpenlhClient/network.py 2008-10-11 19:24:28 UTC (rev 295)
@@ -1,412 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2008 Wilson Pinto Júnior (N3RD3X) <n3...@gu...>
-#
-# 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, see <http://www.gnu.org/licenses/>.
-
-import sys
-import re
-import gobject
-import socket
-import time
-import logging
-import traceback
-
-from threading import RLock, Lock
-from os import path as ospath
-from OpenlhClient import xmlpickler
-
-try:
- import gnutls.crypto
- import gnutls.connection
-
- HAS_GNUTLS = True
-except:
- HAS_GNUTLS = False
-
-class ResponseError(Exception):
- pass
-
-class Response(gobject.GObject):
- waiting = True
- done = False
-
- __gsignals__ = {'done': (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_PYOBJECT,)),
- }
-
- def __init__(self, id):
- self.__gobject_init__()
- self.id = id
-
- def get_value(self):
- if hasattr(self, 'value'):
- return self.value
- else:
- raise ResponseError('Response is not done')
-
- def set_value(self, value):
- self.value = value
- self.done = True
- self.waiting = False
- self.emit('done', self.value)
-
-class Client(gobject.GObject):
-
- __gsignals__ = {'connected':(gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- (gobject.TYPE_STRING,)),
-
- 'disconnected':(gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE,
- ()),
-
- }
-
- address_family = socket.AF_INET
- socket_type = socket.SOCK_STREAM
-
- rbufsize = -1
- wbufsize = 0
- receive = False
- handshake = True
- current = {}
- current['type'] = None
- current['data'] = []
- currid = 1
- dispatch_func = None
- recvfile_func = None
- open_responses = {}
- io_session_handler_id = 0
-
- def __init__(self, server, port, cert, key, hash_id):
-
- self.__gobject_init__()
-
- self._server = server
- self._port = port
-
- self.cert = gnutls.crypto.X509Certificate(open(cert).read())
- self.key = gnutls.crypto.X509PrivateKey(open(key).read())
- self.hash_id = hash_id
- self.cred = gnutls.connection.X509Credentials(self.cert, self.key)
-
- self.socket = socket.socket(self.address_family, self.socket_type)
- self.session = gnutls.connection.ClientSession(self.socket, self.cred)
- self.logger = logging.getLogger('connection.server')
- self.send_lock = RLock()
-
- def parse_headers(self, data):
-
- ##### RESPONSE #####
-
- ### HEAD XMLRESPONSE
- if data.startswith('-----BEGIN XMLRESPONSE'):
- regex = re.compile(r'-----BEGIN XMLRESPONSE'+
- ' ID=(?P<id>\d+) SIZE=(?P<size>\d+)-----')
-
- try:
- out = regex.match(data)
-
- if out:
- self.current['id'] = int(out.group('id'))
- self.current['size'] = int(out.group('size'))
- self.current['type'] = 'XMLRESPONSE'
- self.current['size_remaining'] = self.current['size']
- self.current['data'] = []
-
- except Exception, error:
- self.logger.error(error)
-
- ### END XMLRESPONSE
- elif (self.current['type'] == 'XMLRESPONSE' and
- data == '-----END XMLRESPONSE-----'):
-
- if self.current['size_remaining'] != 0:
- self.logger.warning('size_remaining != 0')
-
- outdata = ''.join(self.current['data'])
-
- self.current['type'] = None
- self.current['data'] = []
-
- response = xmlpickler.loads(outdata)[0][0]
-
- if self.open_responses.has_key(self.current['id']):
- self.open_responses[self.current['id']].set_value(response)
- self.open_responses.pop(self.current['id'])
-
- ##### REQUEST #####
-
- ### HEAD XMLREQUEST
- elif data.startswith('-----BEGIN XMLREQUEST '):
-
- regex = re.compile(r'-----BEGIN XMLREQUEST ' +
- 'ID=(?P<id>\d+) SIZE=(?P<size>\d+)-----')
-
- try:
- out = regex.match(data)
-
- if out:
- self.current['id'] = int(out.group('id'))
- self.current['size'] = int(out.group('size'))
- self.current['type'] = 'XMLREQUEST'
- self.current['size_remaining'] = self.current['size']
- self.current['data'] = []
-
- self.logger.debug('parsing head request, id:%d, size:%d' %
- (self.current['id'], self.current['size']))
-
- except Exception, error:
- self.logger.error(error)
-
- ### END XMLREQUEST
- elif (self.current['type'] == 'XMLREQUEST' and
- data == '-----END XMLREQUEST-----'):
-
- self.logger.debug('done request, id:%d, size:%d' %
- (self.current['id'], self.current['size']))
-
- if self.current['size_remaining'] != 0:
- self.logger.warning('size_remaining != 0')
-
- outdata = ''.join(self.current['data'])
- self.current['type'] = None
- self.current['data'] = []
- id = self.current['id']
-
- params, method = xmlpickler.loads(outdata)
-
- if self.dispatch_func:
- response = self.dispatch_func(method, params)
-
- else:
- response = None
-
- self.send_response(id, response)
-
- ##SENDFILE
- elif data.startswith('-----BEGIN SENDFILE '):
- regex = re.compile(r'-----BEGIN SENDFILE ID=(?P<id>\d+) ' +
- 'METHOD=(?P<method>[\w.]+) SIZE=(?P<size>\d+)-----')
-
- try:
- out = regex.match(data)
-
- if out:
- self.current['id'] = int(out.group('id'))
- self.current['method'] = out.group('method')
- self.current['size'] = int(out.group('size'))
- self.current['type'] = 'SENDFILE'
- self.current['size_remaining'] = self.current['size']
- self.current['data'] = []
-
- except Exception, error:
- self.logger.error(error)
-
- ### END SENDFILE
- elif (self.current['type'] == 'SENDFILE' and
- data == '-----END SENDFILE-----'):
-
- data = ''.join(self.current['data'])
- method = self.current['method']
- self.current['data'] = []
- self.current['type'] = None
-
- self.logger.debug('done sent file, method:%s, size:%d' %
- (self.current['method'], self.current['size']))
-
- if self.current['size_remaining'] != 0:
- self.logger.warning('size_remaining != 0')
-
- if self.recvfile_func and callable(self.recvfile_func):
- self.recvfile_func(method, data)
-
- def parse_data(self, data):
- ##JOIN DATA TODO: ADD OVERFLOOD CONTROL
- if not self.current['type']:
- self.logger.debug('error no type defined')
- return
-
- self.current['data'].append(data)
- self.current['size_remaining'] -= len(self.current['data'][-1])
-
- def handler(self, session, *args):
- try:
- data = self.session.recv(1024)
-
- if data == 0 or data == '' or data == 'CLOSE':
- raise SystemError('Disconnected from server')
-
- if data.startswith('-----') and data.endswith('-----'):
-
- try:
- self.parse_headers(data)
- except Exception, error:
- traceback.print_exc()
- self.logger.error(error)
-
- elif data:
- self.parse_data(data)
-
- return True
-
- except Exception, error:
- self.logger.error(error)
- self.stop()
-
- return False
-
- def start(self):
- try:
- self.session.connect((self._server, self._port))
-
- if self.handshake:
- self.session.handshake()
-
- self.emit('connected', (self._server, self._port))
-
- self.rfile = self.session.makefile('rb', self.rbufsize)
- self.wfile = self.session.makefile('wb', self.wbufsize)
-
- self.send_hash_id()
- self.io_session_handler_id = gobject.io_add_watch(self.session,
- gobject.IO_IN, self.handler)
-
- return True
-
- except Exception, error:
- try:
- (code, msg) = error
- except ValueError:
- msg = str(error)
-
- self.logger.error(msg)
- return False
-
- def stop(self):
- self.logger.info('connection closed')
- self.receive = False
-
- if self.io_session_handler_id:
- gobject.source_remove(self.io_session_handler_id)
-
- try:
- self.session.send('CLOSE')
- except:
- pass
-
- try:
- self.session.shutdown()
- except:
- pass
-
- try:
- self.session.close()
- except:
- pass
-
- try:
- if not self.wfile.closed:
- self.wfile.flush()
-
- self.wfile.close()
- self.rfile.close()
-
- except:
- pass
-
- self.emit('disconnected')
-
- def send_hash_id(self):
- self.session.send('-----HASH_ID=%s-----' % self.hash_id)
-
- def request(self, method, params=()):
-
- if not isinstance(params, tuple):
- params = (params,)
-
- xmlout = xmlpickler.dumps(params, method)
- size = len(xmlout)
-
- head = "-----BEGIN XMLREQUEST ID=%d SIZE=%d-----" % (self.currid, size)
- self.send_lock.acquire()
- self.session.send(head)
- self.session.send(xmlout)
- self.session.send("-----END XMLREQUEST-----")
-
- self.send_lock.release()
-
- response = Response(self.currid)
- self.open_responses[self.currid] = response
- self.currid += 1
-
- return response
-
- def send_response(self, id, response):
- """
- Send Response to peer
- """
-
- self.logger.info('sending response number %d' % id)
-
- try:
- output = xmlpickler.dumps((response,), methodresponse=1)
- head = '-----BEGIN XMLRESPONSE ID=%d SIZE=%d-----' % (id, len(output))
- self.send_lock.acquire()
- self.session.send(head)
- self.session.send(output)
- self.session.send("-----END XMLRESPONSE-----")
-
- except Exception, error:
- self.logger.error(error)
-
- self.send_lock.release()
-
- def send_file(self, method, filepath):
-
- self.logger.info('Sending %s file to server' % filepath)
-
- assert ospath.exists(filepath), 'File not Found'
-
- f = open(filepath)
- size = ospath.getsize(filepath)
-
- head = "-----BEGIN SENDFILE ID=%d METHOD=%s SIZE=%d-----" % (self.currid,
- method, size)
-
- self.currid += 1
- self.send_lock.acquire()
-
- try:
- self.session.send(head)
-
- while True:
- data = f.read(1024)
- if data != "":
- self.session.send(data)
- else:
- break
-
- self.session.send("-----END SENDFILE-----")
-
- self.logger.info('Done: File sent %s to server' % filepath)
-
- except Exception, error:
- self.logger.error(error)
-
- self.send_lock.release()
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-11 19:21:26
|
Revision: 294
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=294&view=rev
Author: n3rd3x
Date: 2008-10-11 19:21:16 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
* Client network moved to OpenlhCore Module
Modified Paths:
--------------
trunk/openlh-client/src/OpenlhClient/main.py
trunk/openlh-core/src/OpenlhCore/net/backends/gnutls_backend.py
trunk/openlh-core/src/OpenlhCore/net/client.py
trunk/openlh-core/src/OpenlhCore/net/constants.py
trunk/openlh-core/src/OpenlhCore/net/request_handler.py
trunk/openlh-server/src/OpenlhServer/__init__.py
Modified: trunk/openlh-client/src/OpenlhClient/main.py
===================================================================
--- trunk/openlh-client/src/OpenlhClient/main.py 2008-10-11 17:59:13 UTC (rev 293)
+++ trunk/openlh-client/src/OpenlhClient/main.py 2008-10-11 19:21:16 UTC (rev 294)
@@ -23,14 +23,17 @@
import gconf
import gobject
+from OpenlhCore.net.client import NetClient
+
from OpenlhClient.ui import icons
from OpenlhClient.ui import tray
from OpenlhClient.globals import *
-from OpenlhClient import login, network
+from OpenlhClient import login
from OpenlhClient.utils import get_os, md5_cripto, humanize_time
from OpenlhClient.ui import dialogs
from OpenlhClient.ui.utils import get_gtk_builder
from OpenlhClient.dbus_manager import Server
+
from os import remove
from os import path as ospath
_ = gettext.gettext
@@ -92,13 +95,13 @@
if not self.port: #FIXED BUG: Cannot connect if gconf value is None
self.port = 4558
- self.network = network.Client(self.server, self.port,
+ self.netclient = NetClient(self.server, self.port,
CLIENT_TLS_CERT, CLIENT_TLS_KEY, self.hash_id)
- self.network.connect('connected', self.connected)
- self.network.connect('disconnected', self.disconnected)
- self.network.dispatch_func = self.dispatch
- self.network.recvfile_func = self.recvfile_func
+ self.netclient.connect('connected', self.connected)
+ self.netclient.connect('disconnected', self.disconnected)
+ self.netclient.dispatch_func = self.dispatch
+ self.netclient.recvfile_func = self.recvfile_func
#icons
self.icons = icons.Icons()
@@ -143,7 +146,7 @@
self.login_window = login.Login(self)
self.login_window.run()
- if not self.network.start():
+ if not self.netclient.start():
self.login_window.set_connected(False)
def on_window_delete_event(self, *args):
@@ -296,13 +299,13 @@
if 'background_md5' in data:
if (data['background_md5'] != self.background_md5
or not(self.background_md5)):
- self.network.request('get_background')
+ self.netclient.request('get_background')
background_requested = True
logo_requested = False
if 'logo_md5' in data:
if (data['logo_md5'] != self.logo_md5 or not(self.logo_md5)):
- self.network.request('get_logo')
+ self.netclient.request('get_logo')
logo_requested = True
if 'use_background' in data:
@@ -418,13 +421,13 @@
self.set_logo(data)
def reload_network(self):
- self.network = network.Client(self.server, self.port,
+ self.netclient = NetClient(self.server, self.port,
CLIENT_TLS_CERT, CLIENT_TLS_KEY, self.hash_id)
- self.network.connect('connected', self.connected)
- self.network.connect('disconnected', self.disconnected)
- self.network.dispatch_func = self.dispatch
- self.network.recvfile_func = self.recvfile_func
+ self.netclient.connect('connected', self.connected)
+ self.netclient.connect('disconnected', self.disconnected)
+ self.netclient.dispatch_func = self.dispatch
+ self.netclient.recvfile_func = self.recvfile_func
def update_time_status(self):
if not self.update_time:
@@ -458,7 +461,7 @@
self.update_time_status)
def monitory_status(self):
- request = self.network.request('get_status')
+ request = self.netclient.request('get_status')
request.connect("done", self.on_get_status_request_done)
self.monitory_handler_id = gobject.timeout_add(120000,
self.monitory_status)
@@ -599,7 +602,7 @@
def on_login(self, username, password):
self.login_window.set_lock_all(True)
- request = self.network.request('login', (username, password))
+ request = self.netclient.request('login', (username, password))
request.connect("done", self.on_login_response)
def on_logout_menuitem_activate(self, obj):
@@ -614,5 +617,5 @@
dlg.destroy()
if response == gtk.RESPONSE_YES:
- self.network.request('logout')
+ self.netclient.request('logout')
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/backends/gnutls_backend.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/backends/gnutls_backend.py 2008-10-11 17:59:13 UTC (rev 293)
+++ trunk/openlh-core/src/OpenlhCore/net/backends/gnutls_backend.py 2008-10-11 19:21:16 UTC (rev 294)
@@ -56,4 +56,25 @@
def accept(self):
new_session, address = self.session.accept()
session = ServerSession(new_session)
- return (session, address)
\ No newline at end of file
+ return (session, address)
+
+class ClientSession:
+ address_family = socket.AF_INET
+ socket_type = socket.SOCK_STREAM
+
+ def __init__(self, privkey_path, selfsigned_path):
+
+ self.cert = gnutls.crypto.X509Certificate(open(selfsigned_path).read())
+ self.key = gnutls.crypto.X509PrivateKey(open(privkey_path).read())
+
+ self.cred = gnutls.connection.X509Credentials(self.cert, self.key)
+
+ self.socket = socket.socket(self.address_family, self.socket_type)
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+
+ self.session = gnutls.connection.ClientSession(self.socket, self.cred)
+
+ def __getattr__(self, name):
+ ## Generic wrapper for the underlying socket methods and attributes
+ return getattr(self.session, name)
+
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/client.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/client.py 2008-10-11 17:59:13 UTC (rev 293)
+++ trunk/openlh-core/src/OpenlhCore/net/client.py 2008-10-11 19:21:16 UTC (rev 294)
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
#
# 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
@@ -14,4 +14,435 @@
# 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/>.
\ No newline at end of file
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import re
+import gobject
+import socket
+import logging
+import traceback
+
+try:
+ from OpenlhCore.net.backends import gnutls_backend as gnutls
+except Exception, error:
+ print error
+ gnutls = None
+
+try:
+ from OpenlhCore.net.backends import openssl_backend as openssl #this backend is not working now
+except Exception, error:
+ print error
+ openssl = None
+
+from xmlrpclib import loads as xmlpickler_loads
+from xmlrpclib import dumps as xmlpickler_dumps
+
+from OpenlhCore.net.response import Response
+from OpenlhCore.net.constants import *
+
+from os import path as ospath
+from threading import RLock
+
+class NetClient(gobject.GObject):
+ """
+ Network Client Class
+ """
+ __gsignals__ = {'connected':(gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_STRING,)),
+
+ 'disconnected':(gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ ()),
+
+ }
+
+ rbufsize = -1
+ wbufsize = 0
+ receive = False
+ handshake = True
+
+ current_id = None
+ current_size = None
+ current_type = None
+ current_size_remaining = None
+ current_data = None
+ current_method = None
+
+ currid = 1
+
+ dispatch_func = None
+ recvfile_func = None
+
+ open_responses = {}
+ io_session_handler_id = 0
+
+ def __init__(self, server, port, cert_path, key_path, hash_id):
+
+ self.__gobject_init__()
+
+ self._server = server
+ self._port = port
+ self.hash_id = hash_id
+
+ self.send_lock = RLock()
+ self.logger = logging.getLogger('net:Client')
+
+ self.session = gnutls.ClientSession(key_path, cert_path)
+
+ def handle_headers(self, data):
+ """
+ Handler header and return missing data
+ """
+
+ #Begin XMLRESPONSE
+ if data.startswith('-----BEGIN XMLRESPONSE'):
+ try:
+ out = XMLResponseRegex.match(data)
+
+ if out:
+ self.current_id = int(out.group('id'))
+ self.current_size = int(out.group('size'))
+ self.current_type = XMLRESPONSE_TYPE
+ self.current_size_remaining = self.current_size
+ self.current_data = []
+ data = out.group('data')
+ else:
+ data = ""
+
+ except:
+ traceback.print_exc()
+ data = ""
+
+ return data
+
+ #End XMLRESPONSE
+ elif (self.current_type == XMLRESPONSE_TYPE and
+ data.startswith(END_XMLRESPONSE_HEADER)):
+
+ self.check_and_alert_size_remaining()
+
+ outdata = ''.join(self.current_data)
+
+ self.current_type = None
+ self.current_data = []
+
+ response = xmlpickler_loads(outdata)[0][0]
+
+ if self.open_responses.has_key(self.current_id):
+ self.open_responses[self.current_id].set_value(response)
+ self.open_responses.pop(self.current_id)
+
+ data = data[len(END_XMLRESPONSE_HEADER):]
+
+ return data
+
+ #Begin XMLREQUEST
+ elif data.startswith('-----BEGIN XMLREQUEST'):
+
+ try:
+ out = XMLRequestRegex.match(data)
+
+ if out:
+ self.current_id = int(out.group('id'))
+ self.current_size = int(out.group('size'))
+ self.current_type = XMLREQUEST_TYPE
+ self.current_size_remaining = self.current_size
+ self.current_data = []
+
+ data = out.group('data')
+ else:
+ data = ""
+
+ except:
+ traceback.print_exc()
+ data = ""
+
+ return data
+
+ #End XMLREQUEST
+ elif (self.current_type == XMLREQUEST_TYPE and
+ data.startswith(END_XMLREQUEST_HEADER)):
+
+ self.check_and_alert_size_remaining()
+
+ outdata = ''.join(self.current_data)
+ self.current_type = None
+ self.current_data = []
+ id = self.current_id
+
+ params, method = xmlpickler_loads(outdata)
+
+ if self.dispatch_func:
+ response = self.dispatch_func(method, params)
+
+ else:
+ response = None
+
+ self.send_response(id, response)
+
+ data = data[len(END_XMLREQUEST_HEADER):]
+
+ return data
+
+ #Begin SENDFILE
+ elif data.startswith('-----BEGIN SENDFILE'):
+
+ try:
+ out = SendFileRegex.match(data)
+
+ if out:
+ self.current_id = int(out.group('id'))
+ self.current_method = out.group('method')
+ self.current_size = int(out.group('size'))
+ self.current_type = SENDFILE_TYPE
+ self.current_size_remaining = self.current_size
+ self.current_data = []
+
+ data = out.group('data')
+ else:
+ data = ""
+
+ except:
+ traceback.print_exc()
+ data = ""
+
+ return data
+
+ #End SENDFILE
+ elif (self.current_type == SENDFILE_TYPE and
+ data.startswith(END_SENDFILE_HEADER)):
+
+ data = ''.join(self.current_data)
+ method = self.current_method
+ self.current_data = []
+ self.current_type = None
+
+ self.check_and_alert_size_remaining()
+
+ if self.recvfile_func and callable(self.recvfile_func):
+ self.recvfile_func(method, data)
+
+ data = data[len(END_SENDFILE_HEADER):]
+
+ return data
+
+ def handle_data(self, data):
+ """
+ Handle data received
+ """
+
+ if not self.current_type:
+ self.logger.debug('error no type defined')
+ return
+
+ self.current_data.append(data)
+ self.current_size_remaining -= len(self.current_data[-1])
+
+ def handle_io(self, session, flags):
+ """
+ Handler all data received
+ """
+
+ if flags & gobject.IO_ERR:
+ print "Flags IO_ERR"
+ return False
+
+ if flags & gobject.IO_HUP:
+ print "Flags IO_HUP"
+ return False
+
+ try:
+ data = self.session.recv(1024)
+
+ if data == 0 or data == '' or data == 'CLOSE':
+ raise IOError('Disconnected from server')
+
+ #headers
+ if data.startswith('-----'):
+
+ try:
+ data = self.handle_headers(data)
+ except Exception, error:
+ traceback.print_exc()
+ data = ""
+
+ #finally data
+ if data:
+ self.handle_data(data)
+
+ return True
+
+ except Exception, error:
+ self.logger.error(error)
+ self.stop()
+
+ return False
+
+ def start(self):
+ """
+ Start Connection in server
+ """
+ try:
+ self.session.connect((self._server, self._port))
+
+ if self.handshake:
+ self.session.handshake()
+
+ self.emit('connected', (self._server, self._port))
+
+ self.rfile = self.session.makefile('rb', self.rbufsize)
+ self.wfile = self.session.makefile('wb', self.wbufsize)
+
+ self.send_hash_id() #Send packet identification to server
+ self.io_session_handler_id = gobject.io_add_watch(self.session,
+ gobject.IO_IN | gobject.IO_ERR | gobject.IO_HUP,
+ self.handle_io)
+
+ return True
+
+ except Exception, error:
+ try:
+ (code, msg) = error
+ except ValueError:
+ msg = str(error)
+
+ traceback.print_exc()
+ self.logger.error(msg)
+ return False
+
+ def stop(self):
+ """
+ Close Connection in Server
+ """
+ self.logger.info('connection closed')
+ self.receive = False
+
+ if self.io_session_handler_id:
+ gobject.source_remove(self.io_session_handler_id)
+
+ try:
+ self.session.send('CLOSE')
+ except:
+ pass
+
+ try:
+ self.session.shutdown()
+ except:
+ pass
+
+ try:
+ self.session.close()
+ except:
+ pass
+
+ try:
+ if not self.wfile.closed:
+ self.wfile.flush()
+
+ self.wfile.close()
+ self.rfile.close()
+ except:
+ pass
+
+ self.emit('disconnected')
+
+ def send_hash_id(self):
+ """
+ Send hash_id packet information to server
+ """
+ self.session.send(HASH_ID_HEADER % self.hash_id)
+
+ def request(self, method, params=()):
+ """
+ Request from peer
+ @method:
+ name of method requested
+ @params:
+ tuple params passed to method
+ """
+ if not isinstance(params, tuple):
+ params = (params,)
+
+ xmlout = xmlpickler_dumps(params, method)
+ size = len(xmlout)
+
+ head = "-----BEGIN XMLREQUEST ID=%d SIZE=%d-----" % (self.currid, size)
+ self.send_lock.acquire()
+ self.session.send(head)
+ self.session.send(xmlout)
+ self.session.send("-----END XMLREQUEST-----")
+
+ self.send_lock.release()
+
+ response = Response(self.currid)
+ self.open_responses[self.currid] = response
+ self.currid += 1
+
+ return response
+
+ def send_response(self, id, response):
+ """
+ Send Response to peer
+ """
+
+ self.logger.info('sending response number %d' % id)
+
+ try:
+ output = xmlpickler_dumps((response,), methodresponse=1)
+ head = '-----BEGIN XMLRESPONSE ID=%d SIZE=%d-----' % (id, len(output))
+ self.send_lock.acquire()
+ self.session.send(head)
+ self.session.send(output)
+ self.session.send("-----END XMLRESPONSE-----")
+
+ except Exception, error:
+ self.logger.error(error)
+
+ self.send_lock.release()
+
+ def send_file(self, method, filepath):
+ """
+ Send file to peer
+ @method:
+ name of method to receive file
+ @filepath:
+ path of file to be send
+ """
+
+ self.logger.info('Sending %s file to server' % filepath)
+
+ assert ospath.exists(filepath), 'File not Found'
+
+ f = open(filepath)
+ size = ospath.getsize(filepath)
+
+ head = "-----BEGIN SENDFILE ID=%d METHOD=%s SIZE=%d-----" % (self.currid,
+ method, size)
+
+ self.currid += 1
+ self.send_lock.acquire()
+
+ try:
+ self.session.send(head)
+
+ while True:
+ data = f.read(1024)
+ if data != "":
+ self.session.send(data)
+ else:
+ break
+
+ self.session.send("-----END SENDFILE-----")
+
+ self.logger.info('Done: File sent %s to server' % filepath)
+
+ except Exception, error:
+ self.logger.error(error)
+
+ self.send_lock.release()
+
+ def check_and_alert_size_remaining(self):
+ if self.current_size_remaining != 0:
+ self.logger.warning('size_remaining != 0, size_remaing = %d' % self.current_size_remaining)
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/constants.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/constants.py 2008-10-11 17:59:13 UTC (rev 293)
+++ trunk/openlh-core/src/OpenlhCore/net/constants.py 2008-10-11 19:21:16 UTC (rev 294)
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import re
+
XMLRESPONSE_TYPE, XMLREQUEST_TYPE, SENDFILE_TYPE = range(1, 4)
BEGIN_XMLRESPONSE_HEADER = '-----BEGIN XMLRESPONSE ID=%d SIZE=%d-----'
@@ -25,4 +27,17 @@
END_XMLREQUEST_HEADER = "-----END XMLREQUEST-----"
BEGIN_SENDFILE_HEADER = "-----BEGIN SENDFILE ID=%d METHOD=%s SIZE=%d-----"
-END_SENDFILE_HEADER = "-----END SENDFILE-----"
\ No newline at end of file
+END_SENDFILE_HEADER = "-----END SENDFILE-----"
+
+HASH_ID_HEADER = '-----HASH_ID=%s-----'
+
+HashIDRegex = re.compile(r'-----HASH_ID=(?P<hash_id>\w+)-----(?P<data>(.*))')
+
+XMLResponseRegex = re.compile(r'-----BEGIN XMLRESPONSE ID=(?P<id>\d+)'
+ r' SIZE=(?P<size>\d+)-----(?P<data>(.*))')
+
+XMLRequestRegex = re.compile(r'-----BEGIN XMLREQUEST'
+ r' ID=(?P<id>\d+) SIZE=(?P<size>\d+)-----(?P<data>(.*))')
+
+SendFileRegex = re.compile(r'-----BEGIN SENDFILE METHOD=(?P<method>[\w.]+) '
+ r'SIZE=(?P<size>\d+)-----(?P<data>(.*))')
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/request_handler.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/request_handler.py 2008-10-11 17:59:13 UTC (rev 293)
+++ trunk/openlh-core/src/OpenlhCore/net/request_handler.py 2008-10-11 19:21:16 UTC (rev 294)
@@ -33,17 +33,6 @@
from OpenlhCore.net.response import Response
from OpenlhCore.net.constants import *
-HashIDRegex = re.compile(r'-----HASH_ID=(?P<hash_id>\w+)-----(?P<data>(.*))')
-
-XMLResponseRegex = re.compile(r'-----BEGIN XMLRESPONSE ID=(?P<id>\d+)'
- r' SIZE=(?P<size>\d+)-----(?P<data>(.*))')
-
-XMLRequestRegex = re.compile(r'-----BEGIN XMLREQUEST'
- r' ID=(?P<id>\d+) SIZE=(?P<size>\d+)-----(?P<data>(.*))')
-
-SendFileRegex = re.compile(r'-----BEGIN SENDFILE METHOD=(?P<method>[\w.]+) '
- r'SIZE=(?P<size>\d+)-----(?P<data>(.*))')
-
class RequestHandler(gobject.GObject):
rbufsize = -1
Modified: trunk/openlh-server/src/OpenlhServer/__init__.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/__init__.py 2008-10-11 17:59:13 UTC (rev 293)
+++ trunk/openlh-server/src/OpenlhServer/__init__.py 2008-10-11 19:21:16 UTC (rev 294)
@@ -16,5 +16,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__all__ = ('net', 'daemon', 'globals', 'ui', 'db', 'g_timer',
+__all__ = ('daemon', 'globals', 'ui', 'db', 'g_timer',
'utils', 'certgen', 'config')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-11 17:59:19
|
Revision: 293
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=293&view=rev
Author: n3rd3x
Date: 2008-10-11 17:59:13 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
OpenlhServer/net removed, because moved to OpenlhCore/net
Modified Paths:
--------------
trunk/openlh-server/src/OpenlhServer/daemon.py
trunk/openlh-server/src/OpenlhServer/utils.py
Removed Paths:
-------------
trunk/openlh-server/src/OpenlhServer/net/
Modified: trunk/openlh-server/src/OpenlhServer/daemon.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/daemon.py 2008-10-11 17:51:43 UTC (rev 292)
+++ trunk/openlh-server/src/OpenlhServer/daemon.py 2008-10-11 17:59:13 UTC (rev 293)
@@ -24,8 +24,8 @@
import time
import datetime
-from OpenlhServer.net.server import NetServer
-from OpenlhServer.net.request_handler import RequestHandler
+from OpenlhCore.net.server import NetServer
+from OpenlhCore.net.request_handler import RequestHandler
from OpenlhServer.globals import *
from OpenlhServer.ui import dialogs
Modified: trunk/openlh-server/src/OpenlhServer/utils.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/utils.py 2008-10-11 17:51:43 UTC (rev 292)
+++ trunk/openlh-server/src/OpenlhServer/utils.py 2008-10-11 17:59:13 UTC (rev 293)
@@ -381,26 +381,4 @@
assert os.path.exists(filename)
b = Builder()
b.add_from_file(filename)
- return b
-
-class DictLimited:
- def __init__(self, limit):
- self._dict = dict()
- self._limit = limit
-
- def __setitem__(self, key, value):
- if not key in self._dict:
- assert len(self._dict) +1 <= self._limit, "this dict is full"
- self._dict[key] = value
-
- def __getitem__(self, key):
- return self._dict[key]
-
- def __delitem__(self, key):
- self._dict.pop(key)
-
- def __str__(self):
- return "<DictLimited(%s)>" % self._dict.__repr__()
-
- def __getattr__(self, attr_name):
- return getattr(self._dict, attr_name)
\ No newline at end of file
+ return b
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-11 17:51:50
|
Revision: 292
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=292&view=rev
Author: n3rd3x
Date: 2008-10-11 17:51:43 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/openlh-core/INSTALL
trunk/openlh-core/src/OpenlhCore/__init__.py
Added Paths:
-----------
trunk/openlh-core/src/OpenlhCore/config.py.in
Modified: trunk/openlh-core/INSTALL
===================================================================
--- trunk/openlh-core/INSTALL 2008-10-11 17:46:00 UTC (rev 291)
+++ trunk/openlh-core/INSTALL 2008-10-11 17:51:43 UTC (rev 292)
@@ -1,9 +1,10 @@
Installation Instructions
*************************
-Copyright (C) 2006, 2007 Wilson N3RD3X <n3...@li...>
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
-This file is free documentation; the Free Software Foundatin gives
+This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
@@ -66,6 +67,9 @@
all sorts of other programs in order to regenerate files that came
with the distribution.
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
Compilers and Options
=====================
Modified: trunk/openlh-core/src/OpenlhCore/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/__init__.py 2008-10-11 17:46:00 UTC (rev 291)
+++ trunk/openlh-core/src/OpenlhCore/__init__.py 2008-10-11 17:51:43 UTC (rev 292)
@@ -16,4 +16,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__all__ = ("utils", "net")
\ No newline at end of file
+__all__ = ("utils", "net", "config")
Added: trunk/openlh-core/src/OpenlhCore/config.py.in
===================================================================
--- trunk/openlh-core/src/OpenlhCore/config.py.in (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/config.py.in 2008-10-11 17:51:43 UTC (rev 292)
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior (N3RD3X) <n3...@gu...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+INSTALLED = True
+PREFIX = "@prefix@"
+APP_VERSION = "@VERSION@"
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-11 17:46:07
|
Revision: 291
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=291&view=rev
Author: n3rd3x
Date: 2008-10-11 17:46:00 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/openlh-core/configure.ac
trunk/openlh-core/src/OpenlhCore/__init__.py
trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py
trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py
trunk/openlh-core/src/OpenlhCore/net/request_handler.py
trunk/openlh-core/src/OpenlhCore/net/server.py
Added Paths:
-----------
trunk/openlh-core/src/OpenlhCore/Makefile.am
trunk/openlh-core/src/OpenlhCore/net/Makefile.am
trunk/openlh-core/src/OpenlhCore/net/backends/Makefile.am
trunk/openlh-core/src/OpenlhCore/net/certgen/Makefile.am
trunk/openlh-core/src/OpenlhCore/utils.py
Removed Paths:
-------------
trunk/openlh-core/src/OpenlhCore/net/certgen/base.py
Modified: trunk/openlh-core/configure.ac
===================================================================
--- trunk/openlh-core/configure.ac 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/configure.ac 2008-10-11 17:46:00 UTC (rev 291)
@@ -44,7 +44,9 @@
Makefile
src/Makefile
src/OpenlhCore/Makefile
-src/OpenlhCore/ui/Makefile
+src/OpenlhCore/net/Makefile
+src/OpenlhCore/net/backends/Makefile
+src/OpenlhCore/net/certgen/Makefile
src/OpenlhCore/config.py
])
Added: trunk/openlh-core/src/OpenlhCore/Makefile.am
===================================================================
--- trunk/openlh-core/src/OpenlhCore/Makefile.am (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/Makefile.am 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,7 @@
+SUBDIRS = net
+
+openlhdir = $(pythondir)/OpenlhCore
+openlh_PYTHON = \
+ __init__.py \
+ utils.py \
+ config.py
Modified: trunk/openlh-core/src/OpenlhCore/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/__init__.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/__init__.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+__all__ = ("utils", "net")
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/Makefile.am
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/Makefile.am (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/Makefile.am 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,10 @@
+SUBDIRS = backends certgen
+
+openlhnetdir = $(pythondir)/OpenlhCore/net
+openlhnet_PYTHON = \
+ __init__.py \
+ client.py \
+ constants.py \
+ request_handler.py \
+ response.py \
+ server.py
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/backends/Makefile.am
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/backends/Makefile.am (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/backends/Makefile.am 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,6 @@
+
+openlhbackendsdir = $(pythondir)/OpenlhCore/net/backends
+openlhbackends_PYTHON = \
+ __init__.py \
+ gnutls_backend.py \
+ openssl_backend.py
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/certgen/Makefile.am
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/Makefile.am (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/Makefile.am 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,6 @@
+
+openlhcertgendir = $(pythondir)/OpenlhCore/net/certgen
+openlhcertgen_PYTHON = \
+ __init__.py \
+ gnutls_certgen.py \
+ openssl_certgen.py
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
#
# 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
@@ -16,4 +16,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__all__ = ()
\ No newline at end of file
+__all__ = ("gnutls_certgen", "openssl_certgen")
Deleted: trunk/openlh-core/src/OpenlhCore/net/certgen/base.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/base.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/base.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
-#
-# 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, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -16,8 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from OpenlhServer.utils import execute_command, is_in_path
-from OpenlhServer.globals import _
+from OpenlhCore.utils import execute_command, is_in_path
CERTTOOL_PATH = is_in_path("certtool")
@@ -25,7 +24,7 @@
bits, data):
if not CERTTOOL_PATH:
- raise SystemError(_("certtool is not installed, please install it"))
+ raise SystemError("certtool is not installed, please install it")
cmd = [CERTTOOL_PATH, "--generate-privkey", "--bits", str(bits)]
@@ -39,4 +38,4 @@
print "Certtool:%s\nPrivkey:%s\nSelfSigned:%s\nTemplate:%s\nBits:%d\n" % (CERTTOOL_PATH, privkey_path,
selfsigned_path,
template_path,
- bits)
\ No newline at end of file
+ bits)
Modified: trunk/openlh-core/src/OpenlhCore/net/request_handler.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/request_handler.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/request_handler.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -25,13 +25,13 @@
from os import path as ospath
from threading import RLock
-from OpenlhServer.utils import DictLimited
+from OpenlhCore.utils import DictLimited
from xmlrpclib import loads as xmlpickler_loads
from xmlrpclib import dumps as xmlpickler_dumps
-from OpenlhServer.net.response import Response
-from OpenlhServer.net.constants import *
+from OpenlhCore.net.response import Response
+from OpenlhCore.net.constants import *
HashIDRegex = re.compile(r'-----HASH_ID=(?P<hash_id>\w+)-----(?P<data>(.*))')
@@ -468,4 +468,4 @@
def check_and_alert_size_remaining(self):
if self.current_size_remaining != 0:
self.logger.warning('size_remaining != 0, size_remaing = %d' % self.current_size_remaining)
-
\ No newline at end of file
+
Modified: trunk/openlh-core/src/OpenlhCore/net/server.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/server.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/server.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -22,13 +22,13 @@
import traceback
try:
- from OpenlhServer.net.backends import gnutls_backend as gnutls
+ from OpenlhCore.net.backends import gnutls_backend as gnutls
except Exception, error:
print error
gnutls = None
try:
- from OpenlhServer.net.backends import openssl_backend as openssl #this backend is not working now
+ from OpenlhCore.net.backends import openssl_backend as openssl #this backend is not working now
except Exception, error:
print error
openssl = None
@@ -185,4 +185,4 @@
def closeall_connections(self):
for con in self.connected_clients:
- con.close()
\ No newline at end of file
+ con.close()
Added: trunk/openlh-core/src/OpenlhCore/utils.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/utils.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/utils.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+import subprocess
+import os
+
+def is_in_path(name_of_command, return_abs_path=True):
+ # if return_abs_path is True absolute path will be returned
+ # for name_of_command
+ # on failures False is returned
+
+ is_in_dir = False
+ found_in_which_dir = None
+ path = os.getenv('PATH').split(':')
+
+ for path_to_directory in path:
+ try:
+ contents = os.listdir(path_to_directory)
+
+ except OSError: # user can have something in PATH that is not a dir
+ pass
+
+ else:
+ is_in_dir = name_of_command in contents
+
+ if is_in_dir:
+ if return_abs_path:
+ found_in_which_dir = path_to_directory
+
+ break
+
+ if found_in_which_dir:
+ abs_path = os.path.join(path_to_directory, name_of_command)
+ return abs_path
+
+ else:
+ return is_in_dir
+
+def execute_command(cmd):
+ """
+ Execute command
+ """
+ if not isinstance(cmd, list):
+ cmd = [cmd]
+
+ env = os.environ
+ po = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, env=env)
+
+ retval = po.wait()
+ (stdout, stderr) = po.communicate()
+
+ return (stdout, stderr, retval)
+
+class DictLimited:
+ def __init__(self, limit):
+ self._dict = dict()
+ self._limit = limit
+
+ def __setitem__(self, key, value):
+ if not key in self._dict:
+ assert len(self._dict) +1 <= self._limit, "this dict is full"
+ self._dict[key] = value
+
+ def __getitem__(self, key):
+ return self._dict[key]
+
+ def __delitem__(self, key):
+ self._dict.pop(key)
+
+ def __str__(self):
+ return "<DictLimited(%s)>" % self._dict.__repr__()
+
+ def __getattr__(self, attr_name):
+ return getattr(self._dict, attr_name)
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-11 17:29:20
|
Revision: 290
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=290&view=rev
Author: n3rd3x
Date: 2008-10-11 17:29:12 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
Added Paths:
-----------
trunk/openlh-core/src/OpenlhCore/net/backends/
trunk/openlh-core/src/OpenlhCore/net/backends/__init__.py
trunk/openlh-core/src/OpenlhCore/net/backends/gnutls_backend.py
trunk/openlh-core/src/OpenlhCore/net/backends/openssl_backend.py
trunk/openlh-core/src/OpenlhCore/net/certgen/
trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py
trunk/openlh-core/src/OpenlhCore/net/certgen/base.py
trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py
trunk/openlh-core/src/OpenlhCore/net/certgen/openssl_certgen.py
Added: trunk/openlh-core/src/OpenlhCore/net/backends/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/backends/__init__.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/backends/__init__.py 2008-10-11 17:29:12 UTC (rev 290)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+__all__ = ("gnutls_backend", "openssl_backend")
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/backends/gnutls_backend.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/backends/gnutls_backend.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/backends/gnutls_backend.py 2008-10-11 17:29:12 UTC (rev 290)
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+import socket
+
+import gnutls
+import gnutls.crypto
+import gnutls.connection
+from gnutls import __version__ as GNUTLS_VERSION
+
+class ServerSession:
+ def __init__(self, session):
+ self.session = session
+
+ def __getattr__(self, name):
+ ## Generic wrapper for the underlying socket methods and attributes
+ return getattr(self.session, name)
+
+class ServerSessionFactory:
+
+ address_family = socket.AF_INET
+ socket_type = socket.SOCK_STREAM
+
+ def __init__(self, privkey_path, selfsigned_path):
+
+ self.cert = gnutls.crypto.X509Certificate(open(selfsigned_path).read())
+ self.key = gnutls.crypto.X509PrivateKey(open(privkey_path).read())
+
+ self.cred = gnutls.connection.X509Credentials(self.cert, self.key)
+
+ self.socket = socket.socket(self.address_family, self.socket_type)
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+
+ self.session = gnutls.connection.ServerSessionFactory(self.socket,
+ self.cred)
+
+ def __getattr__(self, name):
+ ## Generic wrapper for the underlying socket methods and attributes
+ return getattr(self.session, name)
+
+ def accept(self):
+ new_session, address = self.session.accept()
+ session = ServerSession(new_session)
+ return (session, address)
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/backends/openssl_backend.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/backends/openssl_backend.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/backends/openssl_backend.py 2008-10-11 17:29:12 UTC (rev 290)
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+import socket
+
+from OpenSSL import SSL
+
+class ServerSession:
+ def __init__(self, session):
+ self.session = session
+
+ def __getattr__(self, name):
+ print 'ServerSession: getattr', name
+ ## Generic wrapper for the underlying socket methods and attributes
+ if hasattr(self.session, name):
+ return getattr(self.session, name)
+ else:
+ print "not found %s" % name
+
+ def makefile(self, *args):
+ pass
+
+ def handshake(self, *args):
+ pass
+
+class ServerSessionFactory:
+
+ address_family = socket.AF_INET
+ socket_type = socket.SOCK_STREAM
+
+ def __init__(self, privkey_path, selfsigned_path):
+
+ self.ctx = SSL.Context(SSL.TLSv1_METHOD)
+ self.ctx.use_privatekey_file (privkey_path)
+ self.ctx.use_certificate_file(selfsigned_path)
+
+ self.socket = socket.socket(self.address_family, self.socket_type)
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+
+ self.session = SSL.Connection(self.ctx, self.socket)
+
+ def __getattr__(self, name):
+ ## Generic wrapper for the underlying socket methods and attributes
+ print 'ServerSessionFactory: getattr', name
+ return getattr(self.session, name)
+
+ def accept(self):
+ new_session, address = self.session.accept()
+ session = ServerSession(new_session)
+ return (session, address)
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py 2008-10-11 17:29:12 UTC (rev 290)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+__all__ = ()
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/certgen/base.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/base.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/base.py 2008-10-11 17:29:12 UTC (rev 290)
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py 2008-10-11 17:29:12 UTC (rev 290)
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+from OpenlhServer.utils import execute_command, is_in_path
+from OpenlhServer.globals import _
+
+CERTTOOL_PATH = is_in_path("certtool")
+
+def generate_keys(privkey_path, selfsigned_path, template_path,
+ bits, data):
+
+ if not CERTTOOL_PATH:
+ raise SystemError(_("certtool is not installed, please install it"))
+
+ cmd = [CERTTOOL_PATH, "--generate-privkey", "--bits", str(bits)]
+
+ (stdout, stderr, retval) = execute_command(cmd)
+
+ if retval != 0:
+ raise SystemError(stderr)
+ else:
+ print stdout, stderr, retval
+
+ print "Certtool:%s\nPrivkey:%s\nSelfSigned:%s\nTemplate:%s\nBits:%d\n" % (CERTTOOL_PATH, privkey_path,
+ selfsigned_path,
+ template_path,
+ bits)
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/certgen/openssl_certgen.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/openssl_certgen.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/openssl_certgen.py 2008-10-11 17:29:12 UTC (rev 290)
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-11 17:27:50
|
Revision: 289
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=289&view=rev
Author: n3rd3x
Date: 2008-10-11 17:27:44 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
initial state of migration of network to openlh-core
Modified Paths:
--------------
trunk/openlh-core/Makefile.am
trunk/openlh-core/configure.ac
Added Paths:
-----------
trunk/openlh-core/src/Makefile.am
trunk/openlh-core/src/OpenlhCore/__init__.py
trunk/openlh-core/src/OpenlhCore/net/
trunk/openlh-core/src/OpenlhCore/net/__init__.py
trunk/openlh-core/src/OpenlhCore/net/client.py
trunk/openlh-core/src/OpenlhCore/net/constants.py
trunk/openlh-core/src/OpenlhCore/net/request_handler.py
trunk/openlh-core/src/OpenlhCore/net/response.py
trunk/openlh-core/src/OpenlhCore/net/server.py
Modified: trunk/openlh-core/Makefile.am
===================================================================
--- trunk/openlh-core/Makefile.am 2008-10-11 16:54:09 UTC (rev 288)
+++ trunk/openlh-core/Makefile.am 2008-10-11 17:27:44 UTC (rev 289)
@@ -1,20 +1,10 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS = data src po
+SUBDIRS = src
-#DISTCLEANFILES = \
-# intltool-extract \
-# intltool-merge \
-# intltool-update
-
-#EXTRA_DIST = \
-# intltool-extract.in \
-# intltool-merge.in \
-# intltool-update.in
-
CLEANFILES = \
- src/OpenlhServer/*.pyc \
- src/OpenlhServer/*.pyo \
- src/OpenlhServer/ui/*.pyc \
- src/OpenlhServer/ui/*.pyo
+ src/OpenlhCore/*.pyc \
+ src/OpenlhCore/*.pyo \
+ src/OpenlhCore/net/*.pyc \
+ src/OpenlhCore/net/*.pyo
Modified: trunk/openlh-core/configure.ac
===================================================================
--- trunk/openlh-core/configure.ac 2008-10-11 16:54:09 UTC (rev 288)
+++ trunk/openlh-core/configure.ac 2008-10-11 17:27:44 UTC (rev 289)
@@ -13,33 +13,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([OpenLanhouse Server],[0.1],[http://openlanhouse.sf.net],[openlh-server])
+AC_INIT([OpenLanhouse Core],[0.2],[http://trac.openlanhouse.org],[openlh-core])
AM_INIT_AUTOMAKE([1.7])
AM_MAINTAINER_MODE
-GETTEXT_PACKAGE=openlh-server
-AC_SUBST([GETTEXT_PACKAGE])
-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
-AC_PROG_INTLTOOL([0.35.0])
-AM_GLIB_GNU_GETTEXT
-AM_GCONF_SOURCE_2
-AM_PROG_LIBTOOL
-
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
-
-if test x"$GCONFTOOL" = xno; then
- AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
- fi
-
dnl python checks
AM_PATH_PYTHON(2.5)
-dnl gtk dependencie
-PYGTK_REQUIRED=2.12.0
-PKG_CHECK_MODULES([DEPENDENCIES], [
- pygtk-2.0 >= $PYGTK_REQUIRED
-])
-
#python-gnutls
dnl Checking python-gnutls
AC_MSG_CHECKING([for the python-gnutls package])
@@ -59,84 +39,19 @@
$ac_pgnutls_result])
fi
-#python-gconf
-dnl Checking python-gconf
-AC_MSG_CHECKING([for the python-gconf package])
-ac_pgconf_result=`$PYTHON -c 'try:
- import gconf
-except Exception, e:
- print str(e)' 2> /dev/null`
-
-if test -z "$ac_pgconf_result"; then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([cannot import Python module "gconf".
- Please check if you have python-gconf installed. The error was:
- $ac_pgconf_result])
-fi
-
-#python-certtool
-dnl Checking python-certtool
-AC_MSG_CHECKING([for the python-certtool package])
-ac_pgconf_result=`$PYTHON -c 'try:
- import certtool
-except Exception, e:
- print str(e)' 2> /dev/null`
-
-if test -z "$ac_pgconf_result"; then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([cannot import Python module "certtool".
- Please check if you have python-certtool installed. The error was:
- $ac_pgconf_result])
-fi
-
-#python-sqlalchemy
-dnl Checking python-sqlalchemy
-AC_MSG_CHECKING([for the python-sqlalchemy package])
-ac_psqlalchemy_result=`$PYTHON -c 'try:
- import sys
- import sqlalchemy
- from sqlalchemy import __version__
- if not __version__ >= "0.4":
- print "python-sqlalchemy must be 0.4 version or later"
- sys.exit(2)
-except:
- print str(e)' 2> /dev/null`
-exit_code=$?
-
-if (("$exit_code"==0)); then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([cannot import Python module "sqlalchemy".
- Please check if you have python-sqlalchemy installed. The error was:
- $ac_psqlalchemy_result])
-fi
-
dnl output files
AC_CONFIG_FILES([
Makefile
-data/Makefile
-data/openlh-server.desktop.in
-data/glade/Makefile
-data/ui/Makefile
-data/db/Makefile
-data/icons/Makefile
-data/icons/status/Makefile
src/Makefile
-src/OpenlhServer/Makefile
-src/OpenlhServer/ui/Makefile
-src/OpenlhServer/config.py
-po/Makefile.in
+src/OpenlhCore/Makefile
+src/OpenlhCore/ui/Makefile
+src/OpenlhCore/config.py
])
AC_OUTPUT
echo "
-openlh-server-$VERSION:
+openlh-core-$VERSION:
prefix: ${prefix}
Added: trunk/openlh-core/src/Makefile.am
===================================================================
--- trunk/openlh-core/src/Makefile.am (rev 0)
+++ trunk/openlh-core/src/Makefile.am 2008-10-11 17:27:44 UTC (rev 289)
@@ -0,0 +1 @@
+SUBDIRS = OpenlhCore
Added: trunk/openlh-core/src/OpenlhCore/net/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/__init__.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/__init__.py 2008-10-11 17:27:44 UTC (rev 289)
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+__all__ = ('server', 'client', 'response', 'request_handler',
+ 'constants', 'backends', 'certgen')
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/client.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/client.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/client.py 2008-10-11 17:27:44 UTC (rev 289)
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/constants.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/constants.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/constants.py 2008-10-11 17:27:44 UTC (rev 289)
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+XMLRESPONSE_TYPE, XMLREQUEST_TYPE, SENDFILE_TYPE = range(1, 4)
+
+BEGIN_XMLRESPONSE_HEADER = '-----BEGIN XMLRESPONSE ID=%d SIZE=%d-----'
+END_XMLRESPONSE_HEADER = '-----END XMLRESPONSE-----'
+
+BEGIN_XMLREQUEST_HEADER = "-----BEGIN XMLREQUEST ID=%d SIZE=%d-----"
+END_XMLREQUEST_HEADER = "-----END XMLREQUEST-----"
+
+BEGIN_SENDFILE_HEADER = "-----BEGIN SENDFILE ID=%d METHOD=%s SIZE=%d-----"
+END_SENDFILE_HEADER = "-----END SENDFILE-----"
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/request_handler.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/request_handler.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/request_handler.py 2008-10-11 17:27:44 UTC (rev 289)
@@ -0,0 +1,471 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+import sys
+import re
+import gobject
+
+import traceback
+import logging
+
+from os import path as ospath
+from threading import RLock
+from OpenlhServer.utils import DictLimited
+
+from xmlrpclib import loads as xmlpickler_loads
+from xmlrpclib import dumps as xmlpickler_dumps
+
+from OpenlhServer.net.response import Response
+from OpenlhServer.net.constants import *
+
+HashIDRegex = re.compile(r'-----HASH_ID=(?P<hash_id>\w+)-----(?P<data>(.*))')
+
+XMLResponseRegex = re.compile(r'-----BEGIN XMLRESPONSE ID=(?P<id>\d+)'
+ r' SIZE=(?P<size>\d+)-----(?P<data>(.*))')
+
+XMLRequestRegex = re.compile(r'-----BEGIN XMLREQUEST'
+ r' ID=(?P<id>\d+) SIZE=(?P<size>\d+)-----(?P<data>(.*))')
+
+SendFileRegex = re.compile(r'-----BEGIN SENDFILE METHOD=(?P<method>[\w.]+) '
+ r'SIZE=(?P<size>\d+)-----(?P<data>(.*))')
+
+class RequestHandler(gobject.GObject):
+
+ rbufsize = -1
+ wbufsize = 0
+ checking = False
+ currid = 1
+
+ closed = False
+ disconnected = False
+ hash_id = None
+ io_session_handler_id = 0
+
+ current_id = None
+ current_size = None
+ current_type = None
+ current_size_remaining = None
+ current_data = None
+ current_method = None
+
+ def __init__(self, session, client_address, server):
+
+ self.__gobject_init__()
+
+ self.session = session
+ self.client_address = client_address
+ self.server = server
+
+ self.send_lock = RLock()
+ self.open_responses = DictLimited(limit=5)
+
+ self.logger = logging.getLogger('%s:%s' % client_address)
+
+ try:
+ self.setup()
+ self.handshake()
+ gobject.timeout_add(5000, self.check_hash_id)
+ self.io_session_handler_id = gobject.io_add_watch(self.session,
+ gobject.IO_IN | gobject.IO_ERR | gobject.IO_HUP,
+ self.handler_io)
+
+ except:
+ traceback.print_exc()
+ self.close()
+
+ finally:
+ sys.exc_traceback = None
+
+ def setup(self):
+ self.rfile = self.session.makefile('rb', self.rbufsize)
+ self.wfile = self.session.makefile('wb', self.wbufsize)
+
+ def handshake(self):
+ self.session.handshake()
+
+ def close(self):
+ """
+ Close Connection
+ """
+ self.listen = False
+
+ if self.io_session_handler_id:
+ gobject.source_remove(self.io_session_handler_id)
+
+ try:
+ self.session.send('CLOSE')
+ except:
+ pass
+
+ try:
+ self.session.shutdown()
+ except:
+ pass
+
+ try:
+ self.session.close()
+ except:
+ pass
+
+ try:
+ if not self.wfile.closed:
+ self.wfile.flush()
+
+ self.wfile.close()
+ self.rfile.close()
+
+ except:
+ pass
+
+ self.closed = True
+ self.logger.info('connection closed')
+
+ def send_response(self, id, response):
+ """
+ Send reponse to peer
+ """
+
+ try:
+ output = xmlpickler_dumps((response,), methodresponse=1)
+ head = BEGIN_XMLRESPONSE_HEADER % (id, len(output))
+
+ self.send_lock.acquire() #acquire thread lock
+
+ self.session.send(head)
+ self.session.send(output)
+ self.session.send(END_XMLRESPONSE_HEADER)
+
+ except Exception, error:
+ traceback.print_exc()
+ self.logger.error(error)
+
+ self.send_lock.release() #release thread lock
+
+ def request(self, method, params=()):
+ """
+ Request from peer
+ @method:
+ name of method requested
+ @params:
+ tuple params passed to method
+ """
+
+ if not isinstance(params, tuple):
+ params = (params,)
+
+ xmlout = xmlpickler_dumps(params, method)
+ size = len(xmlout)
+ head = BEGIN_XMLREQUEST_HEADER % (self.currid, size)
+
+ self.send_lock.acquire() #acquire thread lock
+
+ try:
+ self.session.send(head)
+ self.session.send(xmlout)
+ self.session.send(END_XMLREQUEST_HEADER)
+ has_error = False
+ except Exception, error:
+ has_error = True
+ self.logger.error(error)
+ traceback.print_exc()
+
+ self.send_lock.release() #release thread lock
+
+ if has_error:
+ return
+
+ response = Response(self.currid)
+ self.open_responses[self.currid] = response
+ self.currid += 1
+
+ return response
+
+ def send_file(self, method, filepath):
+ """
+ Send file to peer
+ @method:
+ name of method to receive file
+ @filepath:
+ path of file to be send
+ """
+
+ self.logger.info('Sending %s file' % filepath)
+
+ assert ospath.exists(filepath), 'File not Found'
+
+ f = open(filepath)
+ size = ospath.getsize(filepath)
+
+ head = BEGIN_SENDFILE_HEADER % (self.currid, method, size)
+
+ self.currid += 1
+
+ self.send_lock.acquire() #acquire thread lock
+
+ try:
+ self.session.send(head)
+
+ while True:
+ data = f.read(1024)
+ if data != "":
+ self.session.send(data)
+ else:
+ break
+
+ self.session.send(END_SENDFILE_HEADER)
+ self.logger.info('Done: File sent %s' % filepath)
+
+ except Exception, error:
+ self.logger.error(error)
+
+ self.send_lock.release()
+
+ def handle_headers(self, data):
+ """
+ Handler header and return missing data
+ """
+
+ #Response Header
+ if data.startswith('-----BEGIN XMLRESPONSE'):
+ try:
+ out = XMLResponseRegex.match(data)
+
+ if out:
+ self.current_id = int(out.group('id'))
+ self.current_size = int(out.group('size'))
+ self.current_type = XMLRESPONSE_TYPE
+ self.current_size_remaining = self.current_size
+ self.current_data = []
+ data = out.group('data')
+ else:
+ data = ""
+
+ except:
+ traceback.print_exc()
+ data = ""
+
+ return data
+
+ #Response End
+ elif (self.current_type == XMLRESPONSE_TYPE and
+ data.startswith(END_XMLRESPONSE_HEADER)):
+
+ self.check_and_alert_size_remaining()
+
+ outdata = ''.join(self.current_data)
+
+ self.current_type = None
+ self.current_data = []
+ id = self.current_id
+
+ try:
+ response = xmlpickler_loads(outdata)[0][0]
+
+ if self.open_responses.has_key(id):
+ self.open_responses[id].set_value(response)
+ self.open_responses.pop(id)
+
+ except Exception, error:
+ self.logger.error(error)
+ traceback.print_exc()
+
+ data = data[len(END_XMLRESPONSE_HEADER):]
+
+ return data
+
+ #Request Header
+ elif data.startswith('-----BEGIN XMLREQUEST'):
+
+ try:
+ out = XMLRequestRegex.match(data)
+
+ if out:
+ self.current_id = int(out.group('id'))
+ self.current_size = int(out.group('size'))
+ self.current_type = XMLREQUEST_TYPE
+ self.current_size_remaining = self.current_size
+ self.current_data = []
+
+ data = out.group('data')
+ else:
+ data = ""
+
+ except Exception, error:
+ self.logger.error(error)
+ traceback.print_exc()
+ data = ""
+
+ return data
+
+ #End Request
+ elif (self.current_type == XMLREQUEST_TYPE and
+ data.startswith(END_XMLREQUEST_HEADER)):
+
+ self.check_and_alert_size_remaining()
+
+ outdata = ''.join(self.current_data)
+ self.current_type = None
+ self.current_data = []
+ id = self.current_id
+
+ params, method = xmlpickler_loads(outdata)
+
+ if self.server.dispatch_func:
+ response = self.server.dispatch_func(self.hash_id,
+ method, params)
+
+ else:
+ response = None
+
+ self.send_response(id, response)
+ data = data[len(END_XMLREQUEST_HEADER):]
+
+ return data
+
+ #SendFile Begin
+ elif data.startswith('-----BEGIN SENDFILE'):
+
+ try:
+ out = SendFileRegex.match(data)
+
+ if out:
+ self.current_method = out.group('method')
+ self.current_size = int(out.group('size'))
+ self.current_type = SENDFILE_TYPE
+ self.current_size_remaining = self.current_size
+ self.current_data = []
+ data = out.group('data')
+ else:
+ data = ""
+
+ except Exception, error:
+ self.logger.error(error)
+ traceback.print_exc()
+ data = ""
+
+ return data
+
+ #SendFile End
+ elif (self.current_type == SENDFILE_TYPE and
+ data.startswith(END_SENDFILE_HEADER)):
+
+ data = ''.join(self.current_data)
+ method = self.current_method
+ self.current_data = []
+ self.current_type = None
+
+ self.logger.debug('done sent file, method:%s, size:%d' %
+ (self.current_method, self.current_size))
+
+ self.check_and_alert_size_remaining()
+
+ if (self.server.recvfile_func and
+ callable(self.server.recvfile_func)):
+
+ self.server.recvfile_func(method, data)
+
+ data = data[len(END_SENDFILE_HEADER):]
+
+ return data
+
+ def handle_data(self, data, client_address):
+ """
+ Handle data received
+ """
+
+ if not self.current_type:
+ self.logger.debug('error no type defined')
+ return
+
+ self.current_data.append(data[:self.current_size_remaining])
+ self.current_size_remaining -= len(data[:self.current_size_remaining])
+
+ def handler_io(self, session, flags):
+ """
+ Handler all data received
+ """
+
+ if flags & gobject.IO_ERR:
+ print "Flags IO_ERR"
+ self.close_session()
+ return False
+
+ if flags & gobject.IO_HUP:
+ print "Flags IO_HUP"
+ self.close_session()
+ return False
+
+ try:
+ data = session.recv(1024)
+
+ if data == 0 or data == '' or data == 'CLOSE':
+ raise IOError('Disconnected from client')
+
+ # Identification packet
+ if data.startswith('-----HASH_ID'):
+ m = HashIDRegex.match(data)
+
+ if m:
+ hash_id = m.group('hash_id')
+ data = m.group('data')
+ else:
+ hash_id = None
+ data = ""
+
+ if hash_id and not self.hash_id:
+ self.hash_id = hash_id
+ self.server.emit('connected', self.client_address,
+ self, self.hash_id)
+
+ #headers
+ if data.startswith('-----'):
+ try:
+ data = self.handle_headers(data)
+ except:
+ traceback.print_exc()
+ data = ""
+
+ #finally data
+ if data:
+ self.handle_data(data, self.client_address)
+
+ return True
+
+ except Exception, error:
+ self.logger.error(str(error))
+ self.close_session()
+ return False
+
+ def check_hash_id(self):
+ """
+ Check hash id after 5 seconds after connection up
+ """
+ if not self.hash_id:
+ self.logger.error('Close Connection: Because no sent hash_id')
+ self.close_session()
+
+ def close_session(self):
+ """
+ Close Socket Session
+ """
+ self.server.disconnect_session(self)
+
+ def check_and_alert_size_remaining(self):
+ if self.current_size_remaining != 0:
+ self.logger.warning('size_remaining != 0, size_remaing = %d' % self.current_size_remaining)
+
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/response.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/response.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/response.py 2008-10-11 17:27:44 UTC (rev 289)
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+import gobject
+
+class Response(gobject.GObject):
+ waiting = True
+ done = False
+
+ __gsignals__ = {'done': (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT,)),
+ }
+
+ def __init__(self, id):
+ self.__gobject_init__()
+ self.id = id
+
+ def get_value(self):
+ if hasattr(self, 'value'):
+ return self.value
+ else:
+ raise ResponseError('Response is not done')
+
+ def set_value(self, value):
+ self.value = value
+ self.done = True
+ self.waiting = False
+ self.emit('done', self.value)
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/server.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/server.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/server.py 2008-10-11 17:27:44 UTC (rev 289)
@@ -0,0 +1,188 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+import gobject
+import socket
+import logging
+import traceback
+
+try:
+ from OpenlhServer.net.backends import gnutls_backend as gnutls
+except Exception, error:
+ print error
+ gnutls = None
+
+try:
+ from OpenlhServer.net.backends import openssl_backend as openssl #this backend is not working now
+except Exception, error:
+ print error
+ openssl = None
+
+class NetServer(gobject.GObject):
+ """
+ Network Server Class
+ """
+
+ __gsignals__ = {'connected':(gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT,
+ gobject.TYPE_PYOBJECT,
+ gobject.TYPE_PYOBJECT
+ )),
+
+ 'disconnected':(gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT,
+ gobject.TYPE_PYOBJECT
+ )),
+
+ }
+
+ request_queue_size = 100
+ allow_reuse_address = True
+ connected_clients = []
+ connected_clients_by_addr = {}
+ handshake = True
+ dispatch_func = None
+ recvfile_func = None
+
+ def __init__(self, server_address, RequestHandlerClass, privkey_path, selfsigned_path):
+
+ self.__gobject_init__()
+
+ self.logger = logging.getLogger('net:Server')
+
+ self.server_address = server_address
+ self.RequestHandlerClass = RequestHandlerClass
+
+ self.session = gnutls.ServerSessionFactory(privkey_path, selfsigned_path)
+
+ self.server_bind()
+ self.server_activate()
+
+ def server_bind(self):
+
+ if self.allow_reuse_address:
+ self.session.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+
+ self.session.bind(self.server_address)
+ self.server_address = self.session.getsockname()
+
+ def server_activate(self):
+ """
+ Activate the server
+ """
+
+ self.session.listen(self.request_queue_size)
+
+ def server_close(self):
+
+ self.session.shutdown()
+ self.session.close()
+
+ def fileno(self):
+ return self.session.fileno()
+
+ def disconnect_session(self, session):
+
+ session.close()
+
+ if session in self.connected_clients:
+ self.connected_clients.remove(session)
+
+ address = session.client_address
+
+ if self.connected_clients_by_addr.has_key(address[0]):
+ if session in self.connected_clients_by_addr[address[0]]:
+ self.connected_clients_by_addr[address[0]].remove(session)
+
+ if not session.disconnected:
+ self.emit('disconnected', address, session.hash_id)
+
+ session.disconnected = True
+
+ def process_connection(self, request, client_address):
+ try:
+ self.finish_request(request, client_address)
+ self.close_connection(request)
+
+ except:
+ self.handle_error(request, client_address)
+ self.close_connection(request)
+
+ def finish_request(self, request, client_address):
+
+ session = self.RequestHandlerClass(request, client_address, self)
+ self.connected_clients.append(session)
+
+ if not self.connected_clients_by_addr.has_key(client_address[0]):
+ self.connected_clients_by_addr[client_address[0]] = []
+
+ self.connected_clients_by_addr[client_address[0]].append(session)
+
+ def handle_connection(self, server_session, flags):
+
+ if flags & gobject.IO_ERR:
+ print "Flags IO_ERR"
+ return False
+
+ if flags & gobject.IO_HUP:
+ print "Flags IO_HUP"
+ return False
+
+ try:
+ session, client_address = server_session.accept()
+ except socket.error:
+ return True
+
+ try:
+ self.process_connection(session, client_address)
+ except:
+ traceback.print_exc()
+ self.handle_error(session, client_address)
+ self.close_connection(session)
+
+ return True
+
+ def close_connection(self, request):
+ """Called to clean up an individual request."""
+ request.close()
+
+ def handle_error(self, request, client_address):
+ print '-' * 40
+ print 'Exception happened during processing of request from',
+ print client_address
+ traceback.print_exc() # XXX But this goes to stderr!
+ print '-' * 40
+
+ def serve_forever(self):
+ self.io_watch_tag = gobject.io_add_watch(self.session,
+ gobject.IO_IN | gobject.IO_ERR | gobject.IO_HUP,
+ self.handle_connection)
+
+ def serve_stop(self):
+ self.closeall_connections()
+
+ if self.io_watch_tag:
+ gobject.source_remove(self.io_watch_tag)
+
+ self.close_connection(self.session)
+
+ def closeall_connections(self):
+ for con in self.connected_clients:
+ con.close()
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <n3...@us...> - 2008-10-11 16:54:21
|
Revision: 288
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=288&view=rev
Author: n3rd3x
Date: 2008-10-11 16:54:09 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
* Added new module OpenlhCore for more code organization
* Initial state of new certgen libraries
Added Paths:
-----------
trunk/openlh-core/
trunk/openlh-core/AUTHORS
trunk/openlh-core/ChangeLog
trunk/openlh-core/INSTALL
trunk/openlh-core/Makefile.am
trunk/openlh-core/NEWS
trunk/openlh-core/README
trunk/openlh-core/TODO
trunk/openlh-core/autogen.sh
trunk/openlh-core/configure.ac
trunk/openlh-core/src/
trunk/openlh-core/src/OpenlhCore/
trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls_certgen.py
trunk/openlh-server/src/OpenlhServer/net/certgen/openssl_certgen.py
Removed Paths:
-------------
trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls.py
trunk/openlh-server/src/OpenlhServer/net/certgen/openssl.py
Added: trunk/openlh-core/AUTHORS
===================================================================
--- trunk/openlh-core/AUTHORS (rev 0)
+++ trunk/openlh-core/AUTHORS 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1 @@
+Wilson Pinto Júnior <wi...@op...>
Added: trunk/openlh-core/INSTALL
===================================================================
--- trunk/openlh-core/INSTALL (rev 0)
+++ trunk/openlh-core/INSTALL 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1,233 @@
+Installation Instructions
+*************************
+
+Copyright (C) 2006, 2007 Wilson N3RD3X <n3...@li...>
+
+This file is free documentation; the Free Software Foundatin gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
Added: trunk/openlh-core/Makefile.am
===================================================================
--- trunk/openlh-core/Makefile.am (rev 0)
+++ trunk/openlh-core/Makefile.am 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1,20 @@
+## Process this file with automake to produce Makefile.in
+SUBDIRS = data src po
+
+#DISTCLEANFILES = \
+# intltool-extract \
+# intltool-merge \
+# intltool-update
+
+#EXTRA_DIST = \
+# intltool-extract.in \
+# intltool-merge.in \
+# intltool-update.in
+
+CLEANFILES = \
+ src/OpenlhServer/*.pyc \
+ src/OpenlhServer/*.pyo \
+ src/OpenlhServer/ui/*.pyc \
+ src/OpenlhServer/ui/*.pyo
+
+
Added: trunk/openlh-core/README
===================================================================
--- trunk/openlh-core/README (rev 0)
+++ trunk/openlh-core/README 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1 @@
+
Added: trunk/openlh-core/TODO
===================================================================
--- trunk/openlh-core/TODO (rev 0)
+++ trunk/openlh-core/TODO 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1 @@
+
Added: trunk/openlh-core/autogen.sh
===================================================================
--- trunk/openlh-core/autogen.sh (rev 0)
+++ trunk/openlh-core/autogen.sh 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+which gnome-autogen.sh || {
+ echo "You need to install gnome-common from GNOME SVN and make"
+ echo "sure the gnome-autogen.sh script is in your \$PATH."
+ exit 1
+}
+
+REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh $@
Property changes on: trunk/openlh-core/autogen.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/openlh-core/configure.ac
===================================================================
--- trunk/openlh-core/configure.ac (rev 0)
+++ trunk/openlh-core/configure.ac 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1,143 @@
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+AC_INIT([OpenLanhouse Server],[0.1],[http://openlanhouse.sf.net],[openlh-server])
+AM_INIT_AUTOMAKE([1.7])
+AM_MAINTAINER_MODE
+GETTEXT_PACKAGE=openlh-server
+AC_SUBST([GETTEXT_PACKAGE])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
+AC_PROG_INTLTOOL([0.35.0])
+AM_GLIB_GNU_GETTEXT
+
+AM_GCONF_SOURCE_2
+AM_PROG_LIBTOOL
+
+AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+
+if test x"$GCONFTOOL" = xno; then
+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+ fi
+
+dnl python checks
+AM_PATH_PYTHON(2.5)
+
+dnl gtk dependencie
+PYGTK_REQUIRED=2.12.0
+PKG_CHECK_MODULES([DEPENDENCIES], [
+ pygtk-2.0 >= $PYGTK_REQUIRED
+])
+
+#python-gnutls
+dnl Checking python-gnutls
+AC_MSG_CHECKING([for the python-gnutls package])
+ac_pgnutls_result=`$PYTHON -c 'try:
+ import gnutls
+ import gnutls.crypto
+ import gnutls.connection
+except Exception, e:
+ print str(e)' 2> /dev/null`
+
+if test -z "$ac_pgnutls_result"; then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot import Python module "gnutls".
+ Please check if you have python-gnutls installed. The error was:
+ $ac_pgnutls_result])
+fi
+
+#python-gconf
+dnl Checking python-gconf
+AC_MSG_CHECKING([for the python-gconf package])
+ac_pgconf_result=`$PYTHON -c 'try:
+ import gconf
+except Exception, e:
+ print str(e)' 2> /dev/null`
+
+if test -z "$ac_pgconf_result"; then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot import Python module "gconf".
+ Please check if you have python-gconf installed. The error was:
+ $ac_pgconf_result])
+fi
+
+#python-certtool
+dnl Checking python-certtool
+AC_MSG_CHECKING([for the python-certtool package])
+ac_pgconf_result=`$PYTHON -c 'try:
+ import certtool
+except Exception, e:
+ print str(e)' 2> /dev/null`
+
+if test -z "$ac_pgconf_result"; then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot import Python module "certtool".
+ Please check if you have python-certtool installed. The error was:
+ $ac_pgconf_result])
+fi
+
+#python-sqlalchemy
+dnl Checking python-sqlalchemy
+AC_MSG_CHECKING([for the python-sqlalchemy package])
+ac_psqlalchemy_result=`$PYTHON -c 'try:
+ import sys
+ import sqlalchemy
+ from sqlalchemy import __version__
+ if not __version__ >= "0.4":
+ print "python-sqlalchemy must be 0.4 version or later"
+ sys.exit(2)
+except:
+ print str(e)' 2> /dev/null`
+exit_code=$?
+
+if (("$exit_code"==0)); then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot import Python module "sqlalchemy".
+ Please check if you have python-sqlalchemy installed. The error was:
+ $ac_psqlalchemy_result])
+fi
+
+dnl output files
+AC_CONFIG_FILES([
+Makefile
+data/Makefile
+data/openlh-server.desktop.in
+data/glade/Makefile
+data/ui/Makefile
+data/db/Makefile
+data/icons/Makefile
+data/icons/status/Makefile
+src/Makefile
+src/OpenlhServer/Makefile
+src/OpenlhServer/ui/Makefile
+src/OpenlhServer/config.py
+po/Makefile.in
+])
+
+AC_OUTPUT
+
+echo "
+openlh-server-$VERSION:
+
+ prefix: ${prefix}
+
+"
Deleted: trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls.py 2008-10-11 14:18:39 UTC (rev 287)
+++ trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls.py 2008-10-11 16:54:09 UTC (rev 288)
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
-#
-# 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, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
Copied: trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls_certgen.py (from rev 282, trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls.py)
===================================================================
--- trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls_certgen.py (rev 0)
+++ trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls_certgen.py 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+from OpenlhServer.utils import execute_command, is_in_path
+from OpenlhServer.globals import _
+
+CERTTOOL_PATH = is_in_path("certtool")
+
+def generate_keys(privkey_path, selfsigned_path, template_path,
+ bits, data):
+
+ if not CERTTOOL_PATH:
+ raise SystemError(_("certtool is not installed, please install it"))
+
+ cmd = [CERTTOOL_PATH, "--generate-privkey", "--bits", str(bits)]
+
+ (stdout, stderr, retval) = execute_command(cmd)
+
+ if retval != 0:
+ raise SystemError(stderr)
+ else:
+ print stdout, stderr, retval
+
+ print "Certtool:%s\nPrivkey:%s\nSelfSigned:%s\nTemplate:%s\nBits:%d\n" % (CERTTOOL_PATH, privkey_path,
+ selfsigned_path,
+ template_path,
+ bits)
\ No newline at end of file
Property changes on: trunk/openlh-server/src/OpenlhServer/net/certgen/gnutls_certgen.py
___________________________________________________________________
Added: svn:mergeinfo
+
Deleted: trunk/openlh-server/src/OpenlhServer/net/certgen/openssl.py
===================================================================
--- trunk/openlh-server/src/OpenlhServer/net/certgen/openssl.py 2008-10-11 14:18:39 UTC (rev 287)
+++ trunk/openlh-server/src/OpenlhServer/net/certgen/openssl.py 2008-10-11 16:54:09 UTC (rev 288)
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
-#
-# 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, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
Copied: trunk/openlh-server/src/OpenlhServer/net/certgen/openssl_certgen.py (from rev 282, trunk/openlh-server/src/OpenlhServer/net/certgen/openssl.py)
===================================================================
--- trunk/openlh-server/src/OpenlhServer/net/certgen/openssl_certgen.py (rev 0)
+++ trunk/openlh-server/src/OpenlhServer/net/certgen/openssl_certgen.py 2008-10-11 16:54:09 UTC (rev 288)
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# 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, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
Property changes on: trunk/openlh-server/src/OpenlhServer/net/certgen/openssl_certgen.py
___________________________________________________________________
Added: svn:mergeinfo
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|