[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erbot-cvs] erbot erbtranslate.el erbutils.el ChangeLog
From: |
D. Goel |
Subject: |
[Erbot-cvs] erbot erbtranslate.el erbutils.el ChangeLog |
Date: |
Mon, 24 Apr 2006 16:57:18 +0000 |
CVSROOT: /cvsroot/erbot
Module name: erbot
Branch:
Changes by: D. Goel <address@hidden> 06/04/24 16:57:18
Modified files:
. : erbtranslate.el erbutils.el ChangeLog
Log message:
improve erbtranslate.el, not yet final.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/erbot/erbot/erbtranslate.el.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/erbot/erbot/erbutils.el.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/erbot/erbot/ChangeLog.diff?tr1=1.45&tr2=1.46&r1=text&r2=text
Patches:
Index: erbot/ChangeLog
diff -u erbot/ChangeLog:1.45 erbot/ChangeLog:1.46
--- erbot/ChangeLog:1.45 Thu Apr 20 18:34:04 2006
+++ erbot/ChangeLog Mon Apr 24 16:57:18 2006
@@ -1,3 +1,9 @@
+2006-04-24 D Goel <address@hidden>
+
+ * erbutils.el (erbutils-enabled-check): new function.
+
+ * erbtranslate.el: revamp the file to make it secure, not yet final.
+
2006-04-20 D Goel <address@hidden>
* erbot.el (erbot-safe-p): Improve this function a bit.
Index: erbot/erbtranslate.el
diff -u erbot/erbtranslate.el:1.2 erbot/erbtranslate.el:1.3
--- erbot/erbtranslate.el:1.2 Wed Apr 19 20:04:53 2006
+++ erbot/erbtranslate.el Mon Apr 24 16:57:18 2006
@@ -1,10 +1,11 @@
;;; erbtranslate.el --- Natural Language translation functions. CURRENTLY
INSECURE.
-;; Time-stamp: <2006-04-19 16:01:44 deego>
+;; Time-stamp: <2006-04-24 12:37:46 deego>
;; Copyright (C) 2002 Alejandro Benitez
;; Emacs Lisp Archive entry
;; Filename: erbc
-;; Package: erbotn
-;; Author: "Alejandro Benitez" <address@hidden>
+;; Package: erbot
+;; Authors: Alejandro Benitez <address@hidden>,
+;; Deepak Goel <address@hidden>
;; Version: 0.0DEV
;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErBot
@@ -29,82 +30,71 @@
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
-
+;; You need to install libtranslate for this to work. The binary,
+;; translate-bin, is provided, for example in Ubuntu Dapper:
+;; http://packages.ubuntu.com/dapper/libs/libtranslate-bin
;; See also:
-
+;; This file needs shs.el
+;;(require 'shs)
(defvar erbtranslate-version "0.0dev")
+(defun erbtranslate-enabled-check ()
+ (erbutils-enabled-check erbn-translate-p))
-(defun fsi-translate (from to text)
- (erbn-translate from to text))
(defalias 'fsi-t8 'fsi-translate)
-(defcustom erbn-translate-p nil
- "This is true by default.. (shell-command \"translate-bin\") has
-exploits.
-todo: erbot-paranoid-p
-")
+(defcustom erbn-translate-p nil
+ "Enabling this should be completely safe. We do use call-process
+here whenever passing any arguments to external commands.")
+
+
+
+(defun fsi-translate (from to text)
+ (erbtranslate-enabled-check)
+ (require 'shs)
+ (shsp
+ (list
+ "translate-bin" "-f" (format "%s" from)
+ "-t" (format "%s" to))
+ nil text))
-(defun erbn-translate (from to text)
- (error "Disabled for now because of security")
- (cond
- (t
- (erbn-shell-command-to-string (format "echo \"%s\" | translate-bin -f %s
-t %s" text from to)
- (list erbn-translate-p)
- ))))
+
+
+(defalias 'fsi-t8-l 'fsi-translate-list-pairs)
+
(defun fsi-translate-list-pairs ()
- (erbn-translate-list-pairs))
+ (erbtranslate-enabled-check)
+ (erbn-shell-command-to-string "translate-bin --list-pairs"
+ t))
-(defalias 'fs-t8-l 'fs-translate-list-pairs)
-(defcustom erbn-translate-list-pairs-p t
- "This is true by default.. since (shell-command \"translate-bin\") is not
-risky.. ")
-
-(defun erbn-translate-list-pairs ()
- (cond
- (t
- (erbn-shell-command-to-string "translate-bin --list-pairs"
- (list erbn-translate-list-pairs-p)
- ))))
+
+(defalias 'fsi-t8-s 'fsi-translate-list-services)
+
(defun fsi-translate-list-services ()
- (erbn-translate-list-services))
+ (erbtranslate-enabled-check)
+ (erbn-shell-command-to-string "translate-bin --list-services"
+ t))
+
-(defalias 'fs-t8-s 'fs-translate-list-services)
-(defcustom erbn-translate-list-services-p t
- "This is true by default.. since (shell-command \"translate-bin\") is not
-risky.. ")
-
-(defun erbn-translate-list-services ()
- (cond
- (t
- (erbn-shell-command-to-string "translate-bin --list-services"
- (list erbn-translate-list-services-p)
- ))))
(defun fsi-translate-web-page (from to url)
- (erbn-translate-web-page from to url))
+ (erbtranslate-enabled-check)
+ (shsp (list "translate-bin" "-f"
+ (format "%s" from) "-t"
+ (format "%s" to)
+ (format "%s" url))))
-(defalias 'fs-t8-w 'fs-translate-web-page)
+(defalias 'fsi-t8-w 'fsi-translate-web-page)
-(defcustom erbn-translate-web-page-p t
- "This is true by default.. since (shell-command \"translate-bin\") is not
-risky.. ")
-
-(defun erbn-translate-web-page (from to url)
- (cond
- (t
- (erbn-shell-command-to-string (format "translate-bin -f %s -t %s %s" from
to url)
- (list erbn-translate-web-page-p)
- ))))
(provide 'erbtranslate)
;;; erbtranslate.el ends here
Index: erbot/erbutils.el
diff -u erbot/erbutils.el:1.30 erbot/erbutils.el:1.31
--- erbot/erbutils.el:1.30 Fri Sep 2 19:24:59 2005
+++ erbot/erbutils.el Mon Apr 24 16:57:18 2006
@@ -1,5 +1,5 @@
;;; erbutils.el ---
-;; Time-stamp: <2005-09-02 14:52:55 deego>
+;; Time-stamp: <2006-04-24 12:30:26 deego>
;; Copyright (C) 2002,2003,2004,2005 D. Goel
;; Emacs Lisp Archive entry
;; Filename: erbutils.el
@@ -712,4 +712,9 @@
(defun erbutils-buffer-string ()
(buffer-substring-no-properties (point-min) (point-max)))
+
+(defmacro erbutils-enabled-check (var)
+ `(when (or erbot-paranoid-p (not ,var))
+ (error "Variable %s is disabled, or erbot-paranoid-p is t. " ',var)))
+
;;; erbutils.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Erbot-cvs] erbot erbtranslate.el erbutils.el ChangeLog,
D. Goel <=