Logo Search packages:      
Sourcecode: fence-agents version File versions  Download package

static struct ipmi* ipmi_init ( struct ipmi i,
char *  host,
char *  authtype,
char *  user,
char *  password,
int  lanplus,
int  verbose,
int  timeout,
int  power_wait,
int  cipher 
) [static, read]

Multipurpose initializer. Used to either create a new, blank ipmi, or update an existing one, or both.

Definition at line 571 of file ipmilan.c.

Referenced by main().

{
      const char *p;

      if (!i || !i->i_ipmitool)
            p = ipmitool_path();
      else
            p = i->i_ipmitool;

      if (!p) {
            log(LOG_WARNING, "ipmilan: ipmitool not found!\n");
            return NULL;
      }

      if (!i)
            i = malloc (sizeof(*i));
      if (!i)
            return NULL;

      if (host && strlen(host)) {
            i->i_host = strdup(host);
            if (!i->i_host) {
                  free(i);
                  return NULL;
            }
      } else
            i->i_host = NULL;

      if (password && strlen(password)) {
            i->i_password = strdup(password);
            if (!i->i_password) {
                  free(i->i_host);
                  free(i);
                  return NULL;
            }
      } else
            i->i_password = NULL;

      if (authtype && strlen(authtype)) {
            i->i_authtype = strdup(authtype);
            if (!i->i_authtype) {
                  free(i->i_host);
                  if (i->i_password)
                        free(i->i_password);
                  free(i);
                  return NULL;
            }
      } else
            i->i_authtype = NULL;


      if (user && strlen(user)) {
            i->i_user= strdup(user);
            if (!i->i_user) {
                  free(i->i_host);
                  if (i->i_authtype)
                        free(i->i_authtype);
                  if (i->i_password)
                        free(i->i_password);
                  free(i);
                  return NULL;
            }
      } else
            i->i_user = NULL;
      i->i_ipmitool = p;
      i->i_rdfd = -1;
      i->i_wrfd = -1;
      i->i_pid = -1;
      i->i_id = IPMIID;
      i->i_verbose = verbose;
      i->i_lanplus = lanplus;
      i->i_timeout = timeout;
      i->i_power_wait = power_wait;
      i->i_cipher = cipher;

      return i;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index