Print this page
10120 smatch indenting fixes for usr/src/cmd
Reviewed by: Gergő Doma <domag02@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>


   3  * Use is subject to license terms.
   4  */
   5 
   6 /*
   7  * Copyright (c) 1983 Regents of the University of California.
   8  * All rights reserved.
   9  *
  10  * Redistribution and use in source and binary forms are permitted
  11  * provided that the above copyright notice and this paragraph are
  12  * duplicated in all such forms and that any documentation,
  13  * advertising materials, and other materials related to such
  14  * distribution and use acknowledge that the software was developed
  15  * by the University of California, Berkeley.  The name of the
  16  * University may not be used to endorse or promote products derived
  17  * from this software without specific prior written permission.
  18  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  19  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  20  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21  */
  22 




  23 /* derived from @(#)rcmd.c      5.17 (Berkeley) 6/27/88 */
  24 
  25 #include <unistd.h>
  26 #include <stdlib.h>
  27 #include <stdio.h>
  28 #include <ctype.h>
  29 #include <string.h>
  30 #include <pwd.h>
  31 #include <sys/param.h>
  32 #include <sys/types.h>
  33 #include <fcntl.h>
  34 
  35 #include <signal.h>
  36 #include <sys/file.h>
  37 #include <sys/socket.h>
  38 #include <sys/stat.h>
  39 
  40 #include <netinet/in.h>
  41 #include <arpa/inet.h>
  42 #include <netdb.h>


 395                 } else {
 396                         (void) fprintf(stderr, gettext("kcmd: bad connection "
 397                                         "with remote host\n"));
 398                 }
 399                 status = -1;
 400                 goto bad2;
 401         }
 402         if (c != 0) {
 403                 while (read(s, &c, 1) == 1) {
 404                         (void) write(2, &c, 1);
 405                         if (c == '\n')
 406                                 break;
 407                 }
 408                 status = -1;
 409                 goto bad2;
 410         }
 411         (void) sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *)0);
 412         *sock = s;
 413 
 414         /* pass back credentials if wanted */
 415         if (cred) (void) krb5_copy_creds(bsd_context, ret_cred, cred);


 416                 krb5_free_creds(bsd_context, ret_cred);

 417         /*
 418          * Initialize *authconp to auth_context, so
 419          * that the clients can make use of it
 420          */
 421         *authconp = auth_context;
 422 
 423         return (0);
 424 bad2:
 425         if (fd2p != NULL)
 426                 (void) close(*fd2p);
 427 bad:
 428         if (s > 0)
 429                 (void) close(s);
 430         if (get_cred)
 431                 krb5_free_creds(bsd_context, get_cred);
 432         if (ret_cred)
 433                 krb5_free_creds(bsd_context, ret_cred);
 434         if (host_save)
 435                 free(host_save);
 436         (void) sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *)0);




   3  * Use is subject to license terms.
   4  */
   5 
   6 /*
   7  * Copyright (c) 1983 Regents of the University of California.
   8  * All rights reserved.
   9  *
  10  * Redistribution and use in source and binary forms are permitted
  11  * provided that the above copyright notice and this paragraph are
  12  * duplicated in all such forms and that any documentation,
  13  * advertising materials, and other materials related to such
  14  * distribution and use acknowledge that the software was developed
  15  * by the University of California, Berkeley.  The name of the
  16  * University may not be used to endorse or promote products derived
  17  * from this software without specific prior written permission.
  18  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  19  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  20  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21  */
  22 
  23 /*
  24  * Copyright (c) 2018, Joyent, Inc.
  25  */
  26 
  27 /* derived from @(#)rcmd.c      5.17 (Berkeley) 6/27/88 */
  28 
  29 #include <unistd.h>
  30 #include <stdlib.h>
  31 #include <stdio.h>
  32 #include <ctype.h>
  33 #include <string.h>
  34 #include <pwd.h>
  35 #include <sys/param.h>
  36 #include <sys/types.h>
  37 #include <fcntl.h>
  38 
  39 #include <signal.h>
  40 #include <sys/file.h>
  41 #include <sys/socket.h>
  42 #include <sys/stat.h>
  43 
  44 #include <netinet/in.h>
  45 #include <arpa/inet.h>
  46 #include <netdb.h>


 399                 } else {
 400                         (void) fprintf(stderr, gettext("kcmd: bad connection "
 401                                         "with remote host\n"));
 402                 }
 403                 status = -1;
 404                 goto bad2;
 405         }
 406         if (c != 0) {
 407                 while (read(s, &c, 1) == 1) {
 408                         (void) write(2, &c, 1);
 409                         if (c == '\n')
 410                                 break;
 411                 }
 412                 status = -1;
 413                 goto bad2;
 414         }
 415         (void) sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *)0);
 416         *sock = s;
 417 
 418         /* pass back credentials if wanted */
 419         if (cred)
 420                 (void) krb5_copy_creds(bsd_context, ret_cred, cred);
 421 
 422         krb5_free_creds(bsd_context, ret_cred);
 423 
 424         /*
 425          * Initialize *authconp to auth_context, so
 426          * that the clients can make use of it
 427          */
 428         *authconp = auth_context;
 429 
 430         return (0);
 431 bad2:
 432         if (fd2p != NULL)
 433                 (void) close(*fd2p);
 434 bad:
 435         if (s > 0)
 436                 (void) close(s);
 437         if (get_cred)
 438                 krb5_free_creds(bsd_context, get_cred);
 439         if (ret_cred)
 440                 krb5_free_creds(bsd_context, ret_cred);
 441         if (host_save)
 442                 free(host_save);
 443         (void) sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *)0);