Annotation of 43BSDReno/sys/nfs/TEST/billboard/src/bb_set.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  ******************************************************************************
                      3:  *
                      4:  * Module: bb_set.c
                      5:  *
                      6:  * Functions: 
                      7:  *         bb_set_1()          - Set an entry in the billboard.
                      8:  *         bb_unset_1()        - Unset an entry in the billboard.
                      9:  *
                     10:  *
                     11:  ******************************************************************************
                     12:  */
                     13: 
                     14: /*
                     15:  ******************************************************************************
                     16:  * Include Files
                     17:  ******************************************************************************
                     18:  */
                     19: #include <stdio.h>
                     20: #include <rpc/rpc.h>
                     21: #include "common.h"
                     22: #include "protocol.h"
                     23: #include "server.h"
                     24: 
                     25: void bb_board_tag();
                     26: 
                     27: 
                     28: /*************************************************************************
                     29: **                                                                     **
                     30: **  bb_set_1() - Set a location in the board.  This means that the     **
                     31: **  client has successfully tested his client against the specified    **
                     32: **  server.  A password is required.                                   **
                     33: **                                                                     **
                     34: *************************************************************************/
                     35: BB_set_out *
                     36: bb_set_1( p_set)
                     37:   BB_set_in    *p_set;         /* The set_in structure.                */
                     38: {
                     39:     static BB_set_out  result; /* The result of the set operation.     */
                     40: 
                     41:     result.status = BB_SUCCESS;
                     42: 
                     43:     /*
                     44:     **  If the machine being used to send this request is not one
                     45:     **  of the ones owned by this client group then a password must
                     46:     **  be specified.
                     47:     */
                     48:     if ( bb_check_ip( p_set->client) != BB_SUCCESS )
                     49:     {
                     50:        if ( (result.status=bb_check_passwd( p_set->client, p_set->passwd))
                     51:             != BB_SUCCESS )
                     52:        {
                     53:            result.status = BB_BAD_PASSWD;
                     54:            return &result;
                     55:        }
                     56:     }
                     57: 
                     58:     /*
                     59:     **  If the server being verified against is the universal server,
                     60:     **  then change the phase of the client.
                     61:     */
                     62:     if ( strncmp( BB_SUN_SERVER, p_set->server, BB_ID_NAME_LEN) == 0 )
                     63:     {
                     64:        if ( bb_set_phase( p_set->client, BB_SUN_PHASE) != BB_SUCCESS )
                     65:        {
                     66:            result.status = BB_BAD_PHASE;
                     67:            return &result;
                     68:        }
                     69:     }
                     70: 
                     71:     /*
                     72:     **  If the phase is not correct don't let them change the board.
                     73:     */
                     74:     if ( bb_phase_ok( p_set->client) != BB_SUCCESS )
                     75:     {
                     76:        result.status = BB_BAD_PHASE;
                     77:        return &result;
                     78:     }
                     79: 
                     80:     /*
                     81:     **  They are allowed to place a mark in the bill board, so lets do it.
                     82:     */
                     83:     bb_board_tag( p_set, &result, BB_SET);
                     84: 
                     85:     return &result;
                     86: }
                     87: 
                     88: 
                     89: 
                     90: /*************************************************************************
                     91: **                                                                     **
                     92: **  bb_unset_1() - Unset a previously set spot in the bill board.      **
                     93: **                                                                     **
                     94: *************************************************************************/
                     95: BB_set_out *
                     96: bb_unset_1( p_set)
                     97:   BB_set_in    *p_set;         /* The set_in structure.                */
                     98: {
                     99:     static BB_set_out  result; /* The result of the set operation.     */
                    100: 
                    101:     /*
                    102:     **  If the machine being used to send this request is not one
                    103:     **  of the ones owned by this client group then a password must
                    104:     **  be specified.
                    105:     */
                    106:     if ( bb_check_ip( p_set->client) != BB_SUCCESS )
                    107:     {
                    108:        if ( bb_check_passwd( p_set->client, p_set->passwd) != SUCCESS )
                    109:        {
                    110:            result.status = BB_BAD_PASSWD;
                    111:            return &result;
                    112:        }
                    113:     }
                    114: 
                    115:     /*
                    116:     **  If the server being unverified is the universal server,
                    117:     **  then change the phase of the client.
                    118:     */
                    119:     if ( strncmp( BB_SUN_SERVER, p_set->server, BB_ID_NAME_LEN) == 0 )
                    120:     {
                    121:        if ( bb_unset_phase( p_set->client, BB_SUN_PHASE) != BB_SUCCESS )
                    122:        {
                    123:            result.status = BB_BAD_PHASE;
                    124:            return &result;
                    125:        }
                    126:     }
                    127: 
                    128:     /*
                    129:     **  They are allowed to place a mark in the bill board, so lets do it.
                    130:     */
                    131:     bb_board_tag( p_set, &result, BB_UNSET);
                    132: 
                    133:     return &result;
                    134: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.