/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugins.d/askpass-fifo.c

  • Committer: Teddy Hogeborn
  • Date: 2009-09-08 04:41:37 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090908044137-4cxubotvn4etoxxl
* plugins.d/mandos-client.c (main): Bug fix: Check result of setgid().
                                    Bug fix: If taking down network
                                    interface, do not drop privileges
                                    completely; save them and reassert
                                    privileges when needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * along with this program.  If not, see
20
20
 * <http://www.gnu.org/licenses/>.
21
21
 * 
22
 
 * Contact the authors at <https://www.fukt.bsnet.se/~belorn/> and
23
 
 * <https://www.fukt.bsnet.se/~teddy/>.
 
22
 * Contact the authors at <mandos@fukt.bsnet.se>.
24
23
 */
25
24
 
26
25
#define _GNU_SOURCE             /* TEMP_FAILURE_RETRY() */
29
28
#include <iso646.h>             /* and */
30
29
#include <errno.h>              /* errno, EEXIST */
31
30
#include <stdio.h>              /* perror() */
32
 
#include <stdlib.h>             /* EXIT_FAILURE, NULL, size_t, free(), 
 
31
#include <stdlib.h>             /* EXIT_FAILURE, NULL, size_t, free(),
33
32
                                   realloc(), EXIT_SUCCESS */
34
33
#include <fcntl.h>              /* open(), O_RDONLY */
35
34
#include <unistd.h>             /* read(), close(), write(),
62
61
  {
63
62
    size_t buf_allocated = 0;
64
63
    const size_t blocksize = 1024;
65
 
    do{
 
64
    do {
66
65
      if(buf_len + blocksize > buf_allocated){
67
66
        char *tmp = realloc(buf, buf_allocated + blocksize);
68
67
        if(tmp == NULL){
81
80
        return EXIT_FAILURE;
82
81
      }
83
82
      buf_len += (size_t)sret;
84
 
    }while(sret != 0);
 
83
    } while(sret != 0);
85
84
  }
86
85
  
87
86
  /* Close FIFO */