Print this page
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Revert "NEX-5801 Snapshots left over after failed backups"
This reverts commit f182fb95f09036db71fbfc6f0a6b90469b761f21.
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2911 NDMP logging should use syslog and is too chatty
NEX-559 NDMP cannot backup/restore a file which spans multiple tapes

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ndmpd/ndmp/ndmpd_connect.c
          +++ new/usr/src/cmd/ndmpd/ndmp/ndmpd_connect.c
   1    1  /*
   2    2   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
   3    3   * Use is subject to license terms.
   4    4   */
   5      -
   6    5  /*
   7    6   * BSD 3 Clause License
   8    7   *
   9    8   * Copyright (c) 2007, The Storage Networking Industry Association.
  10    9   *
  11   10   * Redistribution and use in source and binary forms, with or without
  12   11   * modification, are permitted provided that the following conditions
  13   12   * are met:
  14   13   *      - Redistributions of source code must retain the above copyright
  15   14   *        notice, this list of conditions and the following disclaimer.
↓ open down ↓ 15 lines elided ↑ open up ↑
  31   30   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  32   31   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  33   32   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  34   33   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  35   34   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  36   35   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  37   36   * POSSIBILITY OF SUCH DAMAGE.
  38   37   */
  39   38  /* Copyright (c) 2007, The Storage Networking Industry Association. */
  40   39  /* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
  41      -/* Copyright 2014 Nexenta Systems, Inc. All rights reserved. */
       40 +/* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */
  42   41  
  43   42  #include <sys/types.h>
  44   43  #include <errno.h>
  45   44  #include <pwd.h>
       45 +#include <syslog.h>
  46   46  #include <sys/socket.h>
  47   47  #include <netinet/in.h>
  48   48  #include <sys/queue.h>
  49   49  #include <arpa/inet.h>
  50   50  #include <md5.h>
  51   51  #include <shadow.h>
  52   52  #include <crypt.h>
  53   53  #include <alloca.h>
  54   54  #include "ndmpd_common.h"
  55   55  #include "ndmpd.h"
↓ open down ↓ 103 lines elided ↑ open up ↑
 159  159          ndmp_send_reply(connection, (void *) &reply,
 160  160              "sending connect_open reply");
 161  161  
 162  162          /*
 163  163           * Set the protocol version.
 164  164           * Must wait until after sending the reply since the reply
 165  165           * must be sent using the same protocol version that was used
 166  166           * to process the request.
 167  167           */
 168  168          if (reply.error == NDMP_NO_ERR) {
 169      -                NDMP_LOG(LOG_DEBUG, "set ver to: %d",
 170      -                    request->protocol_version);
 171  169                  ndmp_set_version(connection, request->protocol_version);
 172  170                  session->ns_protocol_version = request->protocol_version;
 173  171          }
 174  172  }
 175  173  
 176  174  
 177  175  /*
 178  176   * ndmpd_connect_client_auth_v2
 179  177   *
 180  178   * This handler authorizes the NDMP connection.
↓ open down ↓ 11 lines elided ↑ open up ↑
 192  190          ndmp_connect_client_auth_request *request;
 193  191          ndmp_connect_client_auth_reply reply;
 194  192          ndmp_auth_text *auth;
 195  193          ndmpd_session_t *session;
 196  194          ndmp_auth_md5 *md5;
 197  195          unsigned char md5_digest[16];
 198  196          char *passwd, *dec_passwd;
 199  197          char *uname;
 200  198  
 201  199          request = (ndmp_connect_client_auth_request *)body;
 202      -        NDMP_LOG(LOG_DEBUG, "auth_type:%s",
 203      -            request->auth_data.auth_type == NDMP_AUTH_NONE ? "None" :
 204      -            (request->auth_data.auth_type == NDMP_AUTH_TEXT ? "Text" :
 205      -            (request->auth_data.auth_type == NDMP_AUTH_MD5 ? "MD5" :
 206      -            "Invalid")));
 207  200  
 208  201          reply.error = NDMP_NO_ERR;
 209  202  
 210  203          switch (request->auth_data.auth_type) {
 211  204          case NDMP_AUTH_NONE:
 212  205                  /*
 213  206                   * Allow no authorization for development.
 214  207                   * Comment the following for a non-secure production server.
 215  208                   */
 216      -                NDMP_LOG(LOG_ERR, "Authorization denied.");
 217      -                NDMP_LOG(LOG_ERR,
      209 +                syslog(LOG_ERR, "Authorization denied.");
      210 +                syslog(LOG_ERR,
 218  211                      "Authorization type should be md5 or cleartext.");
 219  212                  reply.error = NDMP_ILLEGAL_ARGS_ERR;
 220  213                  ndmpd_audit_connect(connection, EINVAL);
 221  214                  break;
 222  215  
 223  216          case NDMP_AUTH_TEXT:
 224  217                  /* Check authorization.  */
 225  218                  if ((uname = ndmpd_get_prop(NDMP_CLEARTEXT_USERNAME)) == NULL ||
 226  219                      *uname == 0) {
 227      -                        NDMP_LOG(LOG_ERR, "Authorization denied.");
 228      -                        NDMP_LOG(LOG_ERR, "User name is not set at server.");
      220 +                        syslog(LOG_ERR, "Authorization denied.");
      221 +                        syslog(LOG_ERR, "User name is not set at server.");
 229  222                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 230  223                          ndmp_set_authorized(connection, FALSE);
 231  224                          ndmp_send_reply(connection, (void *) &reply,
 232  225                              "sending ndmp_connect_client_auth reply");
 233  226                          ndmpd_audit_connect(connection,
 234  227                              ADT_FAIL_PAM + PAM_AUTH_ERR);
 235  228                          return;
 236  229                  }
 237  230                  auth = &request->auth_data.ndmp_auth_data_u.auth_text;
 238  231                  if (strcmp(uname, auth->user) != 0) {
 239      -                        NDMP_LOG(LOG_ERR,
      232 +                        syslog(LOG_ERR,
 240  233                              "Authorization denied. Not a valid user.");
 241  234                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 242  235                          ndmpd_audit_connect(connection,
 243  236                              ADT_FAIL_PAM + PAM_AUTH_ERR);
 244  237                          break;
 245  238                  }
 246  239                  passwd = ndmpd_get_prop(NDMP_CLEARTEXT_PASSWORD);
 247  240                  if (!passwd || !*passwd) {
 248      -                        NDMP_LOG(LOG_ERR, "Authorization denied.");
 249      -                        NDMP_LOG(LOG_ERR,
      241 +                        syslog(LOG_ERR, "Authorization denied.");
      242 +                        syslog(LOG_ERR,
 250  243                              "Cleartext password is not set at server.");
 251  244                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 252  245                          ndmp_set_authorized(connection, FALSE);
 253  246                          ndmp_send_reply(connection, (void *) &reply,
 254  247                              "sending ndmp_connect_client_auth reply");
 255  248                          ndmpd_audit_connect(connection,
 256  249                              ADT_FAIL_PAM + PAM_AUTH_ERR);
 257  250                          return;
 258  251                  } else {
 259  252                          dec_passwd = ndmp_base64_decode(passwd);
 260  253                  }
 261  254                  if (!dec_passwd || !*dec_passwd ||
 262  255                      strcmp(auth->password, dec_passwd) != 0) {
 263      -                        NDMP_LOG(LOG_ERR,
      256 +                        syslog(LOG_ERR,
 264  257                              "Authorization denied. Invalid password.");
 265  258                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 266      -                } else {
 267      -                        NDMP_LOG(LOG_DEBUG, "Authorization granted.");
 268  259                  }
 269  260                  ndmpd_audit_connect(connection, reply.error ?
 270  261                      ADT_FAIL_PAM + PAM_AUTH_ERR : 0);
 271  262  
 272  263                  free(dec_passwd);
 273  264                  break;
 274  265  
 275  266          case NDMP_AUTH_MD5:
 276  267                  /* Check authorization.  */
 277  268                  if ((uname = ndmpd_get_prop(NDMP_CRAM_MD5_USERNAME)) == NULL ||
 278  269                      *uname == 0) {
 279      -                        NDMP_LOG(LOG_ERR, "Authorization denied.");
 280      -                        NDMP_LOG(LOG_ERR,  "User name is not set at server.");
      270 +                        syslog(LOG_ERR, "Authorization denied.");
      271 +                        syslog(LOG_ERR,  "User name is not set at server.");
 281  272                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 282  273                          ndmp_set_authorized(connection, FALSE);
 283  274                          ndmp_send_reply(connection, (void *) &reply,
 284  275                              "sending ndmp_connect_client_auth reply");
 285  276                          ndmpd_audit_connect(connection,
 286  277                              ADT_FAIL_PAM + PAM_AUTH_ERR);
 287  278                          return;
 288  279                  }
 289  280                  md5 = &request->auth_data.ndmp_auth_data_u.auth_md5;
 290  281                  passwd = ndmpd_get_prop(NDMP_CRAM_MD5_PASSWORD);
 291  282                  if (!passwd || !*passwd) {
 292      -                        NDMP_LOG(LOG_ERR, "Authorization denied.");
 293      -                        NDMP_LOG(LOG_ERR, "MD5 password is not set at server.");
      283 +                        syslog(LOG_ERR, "Authorization denied.");
      284 +                        syslog(LOG_ERR, "MD5 password is not set at server.");
 294  285                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 295  286                          ndmp_set_authorized(connection, FALSE);
 296  287                          ndmp_send_reply(connection, (void *) &reply,
 297  288                              "sending ndmp_connect_client_auth reply");
 298  289                          ndmpd_audit_connect(connection,
 299  290                              ADT_FAIL_PAM + PAM_AUTH_ERR);
 300  291                          return;
 301  292                  } else {
 302  293                          dec_passwd = ndmp_base64_decode(passwd);
 303  294                  }
 304  295                  session = ndmp_get_client_data(connection);
 305  296                  create_md5_digest(md5_digest, dec_passwd,
 306  297                      session->ns_challenge);
 307  298  
 308  299                  if (strcmp(uname, md5->user) != 0) {
 309      -                        NDMP_LOG(LOG_ERR,
      300 +                        syslog(LOG_ERR,
 310  301                              "Authorization denied. Not a valid user.");
 311  302                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 312  303                  } else if (memcmp(md5_digest, md5->auth_digest,
 313  304                      sizeof (md5_digest)) != 0) {
 314      -                        NDMP_LOG(LOG_ERR,
      305 +                        syslog(LOG_ERR,
 315  306                              "Authorization denied. Invalid password.");
 316  307                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 317      -                } else {
 318      -                        NDMP_LOG(LOG_DEBUG, "Authorization granted");
 319  308                  }
 320  309                  ndmpd_audit_connect(connection, reply.error ?
 321  310                      ADT_FAIL_PAM + PAM_AUTH_ERR : 0);
 322  311  
 323  312                  free(dec_passwd);
 324  313                  break;
 325  314  
 326  315          default:
 327  316                  reply.error = NDMP_ILLEGAL_ARGS_ERR;
 328  317          }
↓ open down ↓ 21 lines elided ↑ open up ↑
 350  339   *   void
 351  340   */
 352  341  void
 353  342  ndmpd_connect_server_auth_v2(ndmp_connection_t *connection, void *body)
 354  343  {
 355  344          ndmp_connect_server_auth_request *request;
 356  345          ndmp_connect_server_auth_reply reply;
 357  346  
 358  347          request = (ndmp_connect_server_auth_request *)body;
 359  348  
 360      -        NDMP_LOG(LOG_DEBUG, "auth_type:%s",
 361      -            request->client_attr.auth_type == NDMP_AUTH_NONE ? "None" :
 362      -            (request->client_attr.auth_type == NDMP_AUTH_TEXT ? "Text" :
 363      -            (request->client_attr.auth_type == NDMP_AUTH_MD5 ? "MD5" :
 364      -            "Invalid")));
 365      -
 366  349          reply.error = NDMP_NO_ERR;
 367  350          reply.auth_result.auth_type = request->client_attr.auth_type;
 368  351          switch (request->client_attr.auth_type) {
 369  352          case NDMP_AUTH_NONE:
 370  353                  break;
 371  354  
 372  355          case NDMP_AUTH_TEXT:
 373  356                  reply.auth_result.ndmp_auth_data_u.auth_text.user = "ndmpd";
 374  357                  reply.auth_result.ndmp_auth_data_u.auth_text.password =
 375  358                      "ndmpsdk";
↓ open down ↓ 60 lines elided ↑ open up ↑
 436  419          ndmp_connect_client_auth_request_v3 *request;
 437  420          ndmp_connect_client_auth_reply_v3 reply;
 438  421          ndmp_auth_text_v3 *auth;
 439  422          ndmpd_session_t *session;
 440  423          ndmp_auth_md5_v3 *md5;
 441  424          struct in_addr addr;
 442  425          char *uname;
 443  426          char *type;
 444  427  
 445  428          request = (ndmp_connect_client_auth_request_v3 *)body;
 446      -        NDMP_LOG(LOG_DEBUG, "auth_type %s",
 447      -            request->auth_data.auth_type == NDMP_AUTH_NONE ? "None" :
 448      -            request->auth_data.auth_type == NDMP_AUTH_TEXT ? "Text" :
 449      -            request->auth_data.auth_type == NDMP_AUTH_MD5 ? "MD5" : "Invalid");
 450  429  
 451  430          reply.error = NDMP_NO_ERR;
 452  431  
 453  432          switch (request->auth_data.auth_type) {
 454  433          case NDMP_AUTH_NONE:
 455  434                  type = "none";
 456  435                  reply.error = NDMP_NOT_SUPPORTED_ERR;
 457  436                  ndmpd_audit_connect(connection, ENOTSUP);
 458  437                  break;
 459  438  
 460  439          case NDMP_AUTH_TEXT:
 461  440                  /* Check authorization.  */
 462  441                  if ((uname = ndmpd_get_prop(NDMP_CLEARTEXT_USERNAME)) == NULL ||
 463  442                      *uname == 0) {
 464      -                        NDMP_LOG(LOG_ERR, "Authorization denied.");
 465      -                        NDMP_LOG(LOG_ERR, "User name is not set at server.");
      443 +                        syslog(LOG_ERR, "Authorization denied.");
      444 +                        syslog(LOG_ERR, "User name is not set at server.");
 466  445                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 467  446                          ndmp_set_authorized(connection, FALSE);
 468  447                          ndmp_send_reply(connection, (void *) &reply,
 469  448                              "sending ndmp_connect_client_auth reply");
 470  449                          ndmpd_audit_connect(connection,
 471  450                              ADT_FAIL_PAM + PAM_AUTH_ERR);
 472  451                          return;
 473  452                  }
 474  453                  type = "text";
 475  454                  auth = &request->auth_data.ndmp_auth_data_v3_u.auth_text;
 476  455                  reply.error = ndmpd_connect_auth_text(uname, auth->auth_id,
 477  456                      auth->auth_password);
 478  457                  ndmpd_audit_connect(connection, reply.error ?
 479  458                      ADT_FAIL_PAM + PAM_AUTH_ERR : 0);
 480  459                  break;
 481  460  
 482  461          case NDMP_AUTH_MD5:
 483  462                  /* Check authorization.  */
 484  463                  if ((uname = ndmpd_get_prop(NDMP_CRAM_MD5_USERNAME)) == NULL ||
 485  464                      *uname == 0) {
 486      -                        NDMP_LOG(LOG_ERR, "Authorization denied.");
 487      -                        NDMP_LOG(LOG_ERR, "User name is not set at server.");
      465 +                        syslog(LOG_ERR, "Authorization denied.");
      466 +                        syslog(LOG_ERR, "User name is not set at server.");
 488  467                          reply.error = NDMP_NOT_AUTHORIZED_ERR;
 489  468                          ndmp_set_authorized(connection, FALSE);
 490  469                          ndmp_send_reply(connection, (void *) &reply,
 491  470                              "sending ndmp_connect_client_auth reply");
 492  471                          ndmpd_audit_connect(connection,
 493  472                              ADT_FAIL_PAM + PAM_AUTH_ERR);
 494  473                          return;
 495  474                  }
 496  475                  type = "md5";
 497  476                  session = ndmp_get_client_data(connection);
↓ open down ↓ 9 lines elided ↑ open up ↑
 507  486                  reply.error = NDMP_ILLEGAL_ARGS_ERR;
 508  487                  ndmpd_audit_connect(connection, EINVAL);
 509  488          }
 510  489  
 511  490          if (reply.error == NDMP_NO_ERR) {
 512  491                  ndmp_set_authorized(connection, TRUE);
 513  492          } else {
 514  493                  ndmp_set_authorized(connection, FALSE);
 515  494                  if (tcp_get_peer(connection->conn_sock, &addr.s_addr,
 516  495                      NULL) != -1) {
 517      -                        NDMP_LOG(LOG_ERR,
      496 +                        syslog(LOG_ERR,
 518  497                              "Authorization(%s) denied for %s.", type,
 519  498                              inet_ntoa(IN_ADDR(addr)));
 520  499                  }
 521  500          }
 522  501  
 523  502          ndmp_send_reply(connection, (void *) &reply,
 524  503              "sending ndmp_connect_auth reply");
 525  504  }
 526  505  
 527  506  
↓ open down ↓ 16 lines elided ↑ open up ↑
 544  523  {
 545  524          ndmpd_session_t *session;
 546  525          ndmp_lbr_params_t *nlp;
 547  526          ndmp_notify_connected_request req;
 548  527  
 549  528          if (!(session = (ndmpd_session_t *)ndmp_get_client_data(connection)))
 550  529                  return;
 551  530          if ((nlp = ndmp_get_nlp(session)) == NULL)
 552  531                  return;
 553  532  
 554      -        NDMP_LOG(LOG_DEBUG, "ver: %u",
 555      -            session->ns_protocol_version);
 556      -
 557  533          /* Send the SHUTDOWN message before closing the connection. */
 558  534          req.reason = NDMP_SHUTDOWN;
 559  535          req.protocol_version = session->ns_protocol_version;
 560  536          req.text_reason = "Connection closed by server.";
 561  537  
 562  538          if (ndmp_send_request(connection, NDMP_NOTIFY_CONNECTION_STATUS,
 563  539              NDMP_NO_ERR, (void *) &req, 0) < 0) {
 564      -                NDMP_LOG(LOG_NOTICE, "Sending connection shutdown notify");
      540 +                syslog(LOG_NOTICE, "Sending connection shutdown notify");
 565  541                  return;
 566  542          }
 567  543  
 568  544          (void) mutex_lock(&nlp->nlp_mtx);
 569  545          ndmp_close(connection);
 570  546          session->ns_eof = TRUE;
 571  547          (void) cond_broadcast(&nlp->nlp_cv);
 572  548          (void) mutex_unlock(&nlp->nlp_mtx);
 573  549  }
 574  550  
↓ open down ↓ 67 lines elided ↑ open up ↑
 642  618   *
 643  619   * Returns:
 644  620   *   NULL - error
 645  621   *   connection list element pointer
 646  622   */
 647  623  static struct conn_list *
 648  624  ndmp_connect_list_find(ndmp_connection_t *connection)
 649  625  {
 650  626          struct conn_list *clp;
 651  627  
 652      -        NDMP_LOG(LOG_DEBUG, "connection: 0x%p",
 653      -            connection);
 654      -
 655  628          LIST_FOREACH(clp, &cl_head, cl_q) {
 656  629                  if (clp->cl_conn == connection) {
 657  630                          (void) mutex_unlock(&cl_mutex);
 658  631                          return (clp);
 659  632                  }
 660  633          }
 661  634          return (NULL);
 662  635  }
 663  636  
 664  637  /*
↓ open down ↓ 8 lines elided ↑ open up ↑
 673  646   * Returns:
 674  647   *   0 - success
 675  648   *  -1 - error
 676  649   */
 677  650  int
 678  651  ndmp_connect_list_add(ndmp_connection_t *connection, int *id)
 679  652  {
 680  653          struct conn_list *clp;
 681  654  
 682  655          if (connection == NULL) {
 683      -                NDMP_LOG(LOG_DEBUG, "Invalid argument");
      656 +                syslog(LOG_ERR, "ndmp_connect_list_add: Invalid argument");
 684  657                  return (-1);
 685  658          }
 686  659  
 687  660          if ((clp = ndmp_malloc(sizeof (struct conn_list))) == NULL)
 688  661                  return (-1);
 689  662  
 690  663          clp->cl_conn = connection;
 691  664          clp->cl_id = *id;
 692  665  
 693  666          (void) mutex_lock(&cl_mutex);
↓ open down ↓ 17 lines elided ↑ open up ↑
 711  684   *  -1 - error
 712  685   */
 713  686  int
 714  687  ndmp_connect_list_del(ndmp_connection_t *connection)
 715  688  {
 716  689          struct conn_list *clp;
 717  690  
 718  691          (void) mutex_lock(&cl_mutex);
 719  692          if (!(clp = ndmp_connect_list_find(connection))) {
 720  693                  (void) mutex_unlock(&cl_mutex);
 721      -                NDMP_LOG(LOG_DEBUG, "connection not found");
      694 +                syslog(LOG_ERR, "ndmp_connect_list_del: connection not found");
 722  695                  return (-1);
 723  696          }
 724  697  
 725  698          LIST_REMOVE(clp, cl_q);
 726  699          (void) mutex_unlock(&cl_mutex);
 727  700          free(clp);
 728  701  
 729  702          return (0);
 730  703  }
 731  704  
↓ open down ↓ 8 lines elided ↑ open up ↑
 740  713   *
 741  714   * Returns:
 742  715   *   NULL - error
 743  716   *   connection list element pointer
 744  717   */
 745  718  static struct conn_list *
 746  719  ndmp_connect_list_find_id(int id)
 747  720  {
 748  721          struct conn_list *clp;
 749  722  
 750      -        NDMP_LOG(LOG_DEBUG, "id: %d", id);
 751      -
 752  723          (void) mutex_lock(&cl_mutex);
 753  724          LIST_FOREACH(clp, &cl_head, cl_q) {
 754  725                  if (clp->cl_id == id) {
 755  726                          (void) mutex_unlock(&cl_mutex);
 756  727                          return (clp);
 757  728                  }
 758  729          }
 759  730  
 760  731          (void) mutex_unlock(&cl_mutex);
 761  732          return (NULL);
↓ open down ↓ 256 lines elided ↑ open up ↑
1018  989          case NDMPV2:
1019  990                  ndmp_connect_get_conn(clp, enc_ctx);
1020  991                  ndmp_connect_get_v2(clp->cl_conn, enc_ctx);
1021  992                  break;
1022  993          case NDMPV3:
1023  994          case NDMPV4:
1024  995                  ndmp_connect_get_conn(clp, enc_ctx);
1025  996                  ndmp_connect_get_v3(clp->cl_conn, enc_ctx);
1026  997                  break;
1027  998          default:
1028      -                NDMP_LOG(LOG_DEBUG,
      999 +                syslog(LOG_ERR,
1029 1000                      "Invalid session (0x%p) version 0x%x", session,
1030 1001                      session->ns_protocol_version);
1031 1002          }
1032 1003  }
1033 1004  
1034 1005  /*
1035 1006   * ndmpd_connect_kill
1036 1007   *
1037 1008   * Kill the connection based on its version.
1038 1009   *
↓ open down ↓ 14 lines elided ↑ open up ↑
1053 1024  
1054 1025          switch (session->ns_protocol_version) {
1055 1026          case NDMPV2:
1056 1027                  ndmpd_connect_close_v2(connection, (void *)NULL);
1057 1028                  break;
1058 1029          case NDMPV3:
1059 1030          case NDMPV4:
1060 1031                  ndmpd_connect_close_v3(connection, (void *)NULL);
1061 1032                  break;
1062 1033          default:
1063      -                NDMP_LOG(LOG_DEBUG,
     1034 +                syslog(LOG_ERR,
1064 1035                      "Invalid session (0x%p) version 0x%x", session,
1065 1036                      session->ns_protocol_version);
1066 1037          }
1067 1038  
1068 1039          return (0);
1069 1040  }
1070 1041  
1071 1042  /*
1072 1043   * Get the list of all active sessions to the clients.
1073 1044   */
↓ open down ↓ 44 lines elided ↑ open up ↑
1118 1089  /* Get the devices info */
1119 1090  void
1120 1091  ndmpd_get_devs(ndmp_door_ctx_t *enc_ctx)
1121 1092  {
1122 1093          int i, n;
1123 1094          sasd_drive_t *sd;
1124 1095          scsi_link_t *slink;
1125 1096  
1126 1097          if ((n = sasd_dev_count()) == 0) {
1127 1098                  ndmp_door_put_int32(enc_ctx, n);
1128      -                NDMP_LOG(LOG_DEBUG, "No device attached.");
     1099 +                syslog(LOG_DEBUG, "No device attached.");
1129 1100                  return;
1130 1101          }
1131 1102          ndmp_door_put_int32(enc_ctx, n);
1132 1103  
1133 1104          for (i = 0; i < n; i++) {
1134 1105                  sd = sasd_drive(i);
1135 1106                  slink = sasd_dev_slink(i);
1136 1107  
1137 1108                  ndmp_door_put_int32(enc_ctx, slink->sl_type);
1138 1109                  ndmp_door_put_string(enc_ctx, sd->sd_name);
↓ open down ↓ 38 lines elided ↑ open up ↑
1177 1148                                  rv = NDMP_NOT_AUTHORIZED_ERR;
1178 1149                          else if (strcmp(auth_password, dec_passwd) != 0)
1179 1150                                  rv = NDMP_NOT_AUTHORIZED_ERR;
1180 1151                          else
1181 1152                                  rv = NDMP_NO_ERR;
1182 1153  
1183 1154                          free(dec_passwd);
1184 1155                  }
1185 1156          }
1186 1157  
1187      -        if (rv == NDMP_NO_ERR) {
1188      -                NDMP_LOG(LOG_DEBUG, "Authorization granted.");
1189      -        } else {
1190      -                NDMP_LOG(LOG_ERR, "Authorization denied.");
     1158 +        if (rv != NDMP_NO_ERR) {
     1159 +                syslog(LOG_ERR, "Authorization denied.");
1191 1160          }
1192 1161  
1193 1162          return (rv);
1194 1163  }
1195 1164  
1196 1165  
1197 1166  /*
1198 1167   * ndmpd_connect_auth_md5
1199 1168   *
1200 1169   * Checks MD5 authorization.
↓ open down ↓ 36 lines elided ↑ open up ↑
1237 1206                                      sizeof (digest)) != 0) {
1238 1207                                          rv = NDMP_NOT_AUTHORIZED_ERR;
1239 1208                                  } else {
1240 1209                                          rv = NDMP_NO_ERR;
1241 1210                                  }
1242 1211                          }
1243 1212                          free(dec_passwd);
1244 1213                  }
1245 1214          }
1246 1215  
1247      -        if (rv == NDMP_NO_ERR) {
1248      -                NDMP_LOG(LOG_DEBUG, "Authorization granted.");
1249      -        } else {
1250      -                NDMP_LOG(LOG_ERR, "Authorization denied.");
1251      -        }
1252      -
1253 1216          return (rv);
1254 1217  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX