gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11722: update to work with libssh 0


From: Rob Savoye
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11722: update to work with libssh 0.4.0, which is now required. Older version of libssh are now incompatible.
Date: Sun, 20 Dec 2009 09:54:06 -0700
User-agent: Bazaar (2.0.2)

------------------------------------------------------------
revno: 11722
committer: Rob Savoye <address@hidden>
branch nick: trunk
timestamp: Sun 2009-12-20 09:54:06 -0700
message:
  update to work with libssh 0.4.0, which is now required. Older version of 
libssh are now incompatible.
modified:
  libnet/sshclient.cpp
  libnet/sshclient.h
  libnet/sshserver.cpp
  libnet/sshserver.h
=== modified file 'libnet/sshclient.cpp'
--- a/libnet/sshclient.cpp      2009-07-17 19:35:07 +0000
+++ b/libnet/sshclient.cpp      2009-12-20 16:54:06 +0000
@@ -79,7 +79,6 @@
       _need_server_auth(true),
       _state(0),
       _session(0),
-      _options(0),
       _channel(0)
 {
 //     GNASH_REPORT_FUNCTION;
@@ -173,37 +172,29 @@
 }
 
 bool
-SSHClient::sshConnect(int fd, std::string &hostname)
+SSHClient::sshConnect(int /* fd */, std::string &hostname)
 {
 //     GNASH_REPORT_FUNCTION;
     char *password;
     char *banner;
     char *hexa;
-    char buf[10];
-
-//    _options.reset(ssh_options_new());
-    // Setup the options to for this SSH session
-    _options = ssh_options_new();
 
     // We always need a hostname to connect to
-    if (ssh_options_set_host(_options, hostname.c_str()) < 0) {
+    if (ssh_options_set(_session, SSH_OPTIONS_HOST, hostname.c_str()) < 0) {
        log_error("Couldn't set hostname option");
-       ssh_options_free(_options);
        return false;
     }
 
     // We always need a user name for the connection
     if (_user.empty()) {
-       if (ssh_options_set_username(_options, _user.c_str()) < 0) {
+       if (ssh_options_set(_session, SSH_OPTIONS_USER, _user.c_str()) < 0) {
            log_error("Couldn't set user name option");
-           ssh_options_free(_options);
            return false;
        }
     }
     
     // Start a new session
     _session = ssh_new();
-    ssh_set_options(_session, _options);
     if(ssh_connect(_session)){
         log_error("Connection failed : %s\n", ssh_get_error(_session));
        sshShutdown();
@@ -345,7 +336,7 @@
 }
 
 int
-SSHClient::authKbdint(SSH_SESSION *session)
+SSHClient::authKbdint(ssh_session session)
 {
 //    GNASH_REPORT_FUNCTION;
     int err = ssh_userauth_kbdint(session, NULL, NULL);
@@ -354,15 +345,15 @@
     int i,n;
     char echo;
     while (err == SSH_AUTH_INFO){
-        name = ssh_userauth_kbdint_getname(session);
-        instruction = ssh_userauth_kbdint_getinstruction(session);
+        name = const_cast<char *>(ssh_userauth_kbdint_getname(session));
+        instruction = const_cast<char 
*>(ssh_userauth_kbdint_getinstruction(session));
         n=ssh_userauth_kbdint_getnprompts(session);
         if(strlen(name)>0)
             log_debug("%s", name);
         if(strlen(instruction)>0)
             log_debug("%s", instruction);
         for(i=0; i<n; ++i){
-            prompt = ssh_userauth_kbdint_getprompt(session, i, &echo);
+            prompt = const_cast<char *>(ssh_userauth_kbdint_getprompt(session, 
i, &echo));
             if(echo){
                 log_debug("%s", prompt);
                 fgets(buffer,sizeof(buffer),stdin);
@@ -387,7 +378,7 @@
 }
 
 // Channel operations
-CHANNEL *
+ssh_channel
 SSHClient::openChannel()
 {
 //    GNASH_REPORT_FUNCTION;
@@ -395,8 +386,8 @@
 }
 
 
-CHANNEL *
-SSHClient::openChannel(SSH_SESSION *session)
+ssh_channel
+SSHClient::openChannel(ssh_session session)
 {
 //    GNASH_REPORT_FUNCTION;
     if (session) {
@@ -414,7 +405,7 @@
 }
 
 int 
-SSHClient::readChannel(CHANNEL *channel, amf::Buffer &buf)
+SSHClient::readChannel(ssh_channel channel, amf::Buffer &buf)
 {
 //    GNASH_REPORT_FUNCTION;
     int ret = -1;
@@ -429,7 +420,7 @@
 }
 
 int 
-SSHClient::writeChannel(CHANNEL *channel, amf::Buffer &buf)
+SSHClient::writeChannel(ssh_channel channel, amf::Buffer &buf)
 {
 //    GNASH_REPORT_FUNCTION;
     int ret = -1;
@@ -439,6 +430,8 @@
     } else {
        log_error("Can't write to a non-existant channel!");
     }
+
+    return ret;
 }
 
 void 
@@ -449,7 +442,7 @@
 }
 
 void 
-SSHClient::closeChannel(CHANNEL *channel)
+SSHClient::closeChannel(ssh_channel channel)
 {
 //    GNASH_REPORT_FUNCTION;
 

=== modified file 'libnet/sshclient.h'
--- a/libnet/sshclient.h        2009-07-15 21:44:51 +0000
+++ b/libnet/sshclient.h        2009-12-20 16:54:06 +0000
@@ -98,25 +98,25 @@
     transport_type_t getTransportType() { return _transporttype; };
 
     int authKbdint();
-    int authKbdint(SSH_SESSION *);
+    int authKbdint(ssh_session);
 
     // Channel operations
-    CHANNEL *openChannel();
-    CHANNEL *openChannel(SSH_SESSION *session);
+    ssh_channel openChannel();
+    ssh_channel openChannel(ssh_session session);
 
     void closeChannel();
-    void closeChannel(CHANNEL *channel);
+    void closeChannel(ssh_channel channel);
 
     // Accessors
-    CHANNEL *getChannel()     { return _channel; };
-    SSH_SESSION *getSession() { return _session; };
+    ssh_channel getChannel() { return _channel; };
+    ssh_session getSession() { return _session; };
     boost::shared_ptr<amf::Buffer> &getBuffer()  { return _buffer; };
 
     // Dump internal data to the screen for debugging
     void dump();
  protected:
-    int readChannel(CHANNEL *channel, amf::Buffer &buf);
-    int writeChannel(CHANNEL *channel, amf::Buffer &buf);
+    int readChannel (ssh_channel channel, amf::Buffer &buf);
+    int writeChannel(ssh_channel channel, amf::Buffer &buf);
 
     std::string                _hostname;
     std::string                _user;
@@ -126,12 +126,11 @@
     transport_type_t   _transporttype;
     int                        _state;
 #if 0
-    boost::shared_ptr<SSH_SESSION> _session;
+    boost::shared_ptr<ssh_session> _session;
     boost::shared_ptr<SSH_OPTIONS> _options;
 #else
-    SSH_SESSION *_session;
-    SSH_OPTIONS *_options;
-    CHANNEL    *_channel;
+    ssh_session _session;
+    ssh_channel        _channel;
 #endif
     boost::shared_ptr<amf::Buffer> _buffer;
 };

=== modified file 'libnet/sshserver.cpp'
--- a/libnet/sshserver.cpp      2009-07-20 20:57:44 +0000
+++ b/libnet/sshserver.cpp      2009-12-20 16:54:06 +0000
@@ -95,50 +95,56 @@
 
 // Authenticate the password from the user
 bool
-SSHServer::authPassword(string &user, string &passwd)
+SSHServer::authPassword(string & /* user */, string & /* passwd */)
 {
+    return false;
 }
 
 bool
-SSHServer::authPassword(SSH_SESSION *session, string &user, string &passwd)
+SSHServer::authPassword(ssh_session /* session */, string &/* user */, string 
& /* passwd */)
 {
+    return false;
 }
 
 // Wait for an incoming network connection
 bool
 SSHServer::acceptConnections()
 {
-}
-
-bool
-SSHServer::acceptConnections(short port)
-{
-}
-
-bool
-SSHServer::acceptConnections(SSH_SESSION *session)
-{
-}
-
-bool
-SSHServer::acceptConnections(SSH_SESSION *session, short port)
-{
+    return false;
+}
+
+bool
+SSHServer::acceptConnections(short /* port */)
+{
+    return false;
+}
+
+bool
+SSHServer::acceptConnections(ssh_session /* session */)
+{
+    return false;
+}
+
+bool
+SSHServer::acceptConnections(ssh_session /* session */, short /* port */)
+{
+    return false;
 }
 
 // Parse an SSH command message and do something
 bool
-SSHServer::processSSHMessage(SSH_MESSAGE *message)
+SSHServer::processSSHMessage(ssh_message message)
 {
     if (!message) {
        return false;
     }
     switch(ssh_message_type(message)){
-    case SSH_AUTH_REQUEST:
+    case SSH_REQUEST_AUTH:
        switch(ssh_message_subtype(message)) {
            // not authenticated, send default message
-       case SSH_AUTH_NONE:
+       case SSH_AUTH_METHOD_NONE:
            break;
-       case SSH_AUTH_PASSWORD:
+       case SSH_AUTH_METHOD_PASSWORD:
            {
                log_debug("User %s wants to auth with pass %s\n",
                          ssh_message_auth_user(message),
@@ -152,20 +158,20 @@
                }
                break;
            }
-       case SSH_AUTH_HOSTBASED:
-           break;
-       case SSH_AUTH_PUBLICKEY:
-           break;
-       case SSH_AUTH_KEYBINT:
-           break;
-       case SSH_AUTH_UNKNOWN:
+       case SSH_AUTH_METHOD_HOSTBASED:
+           break;
+       case SSH_AUTH_METHOD_PUBLICKEY:
+           break;
+       case SSH_AUTH_METHOD_INTERACTIVE:
+           break;
+       case SSH_AUTH_METHOD_UNKNOWN:
            break;
        default:
-           ssh_message_auth_set_methods(message,SSH_AUTH_PASSWORD);
+           ssh_message_auth_set_methods(message,SSH_AUTH_METHOD_PASSWORD);
            ssh_message_reply_default(message);
            break;
        }
-    case SSH_CHANNEL_REQUEST_OPEN:
+    case SSH_REQUEST_CHANNEL_OPEN:
        if(ssh_message_subtype(message)==SSH_CHANNEL_SESSION){
            _channel = ssh_message_channel_request_open_reply_accept(message);
            break;
@@ -185,6 +191,8 @@
        ssh_message_reply_default(message);
     }
     ssh_message_free(message);
+
+    return false;
 }
 
 void

=== modified file 'libnet/sshserver.h'
--- a/libnet/sshserver.h        2009-07-17 19:35:07 +0000
+++ b/libnet/sshserver.h        2009-12-20 16:54:06 +0000
@@ -64,26 +64,25 @@
     
     // Authenticate the password from the user
     bool authPassword(std::string &user, std::string &passwd);
-    bool authPassword(SSH_SESSION *session, std::string &user, std::string 
&passwd);
+    bool authPassword(ssh_session session, std::string &user, std::string 
&passwd);
 
     // Wait for an incoming network connection
     bool acceptConnections();
     bool acceptConnections(short port);
-    bool acceptConnections(SSH_SESSION *session);
-    bool acceptConnections(SSH_SESSION *session, short port);
+    bool acceptConnections(ssh_session session);
+    bool acceptConnections(ssh_session session, short port);
 
     // Parse an SSH command message and do something
-    bool processSSHMessage(SSH_MESSAGE *message);
+    bool processSSHMessage(ssh_message message);
 
     void dump();
  protected:
     // Get the SSH command message
-    SSH_MESSAGE *getSSHMessage();
-    SSH_MESSAGE *getSSHMessage(SSH_SESSION *session);
+    ssh_message getSSHMessage();
+    ssh_message getSSHMessage(ssh_session session);
 
-    SSH_SESSION *_session;     // the current session
-    SSH_OPTIONS *_options;     // the current list of options
-    SSH_MESSAGE *_message;     // the current SSH command message
+    ssh_session _session;      // the current session
+    ssh_message _message;      // the current SSH command message
 };
     
 } // end of gnash namespace


reply via email to

[Prev in Thread] Current Thread [Next in Thread]