void check_cluster_compatibility(bool live_check) { char libfile[MAXPGPATH]; FILE *lib_test; /* * Test pg_upgrade_support.so is in the proper place. We cannot copy it * ourselves because install directories are typically root-owned. */ snprintf(libfile, sizeof(libfile), "%s/pg_upgrade_support%s", new_cluster.libpath, DLSUFFIX); if ((lib_test = fopen(libfile, "r")) == NULL) pg_log(PG_FATAL, "\npg_upgrade_support%s must be created and installed in %s\n", DLSUFFIX, libfile); else fclose(lib_test); /* get/check pg_control data of servers */ get_control_data(&old_cluster, live_check); get_control_data(&new_cluster, false); check_control_data(&old_cluster.controldata, &new_cluster.controldata); /* Is it 9.0 but without tablespace directories? */ if (GET_MAJOR_VERSION(new_cluster.major_version) == 900 && new_cluster.controldata.cat_ver < TABLE_SPACE_SUBDIRS) pg_log(PG_FATAL, "This utility can only upgrade to PostgreSQL version 9.0 after 2010-01-11\n" "because of backend API changes made during development.\n"); }
void check_cluster_compatibility(bool live_check) { /* get/check pg_control data of servers */ get_control_data(&old_cluster, live_check); get_control_data(&new_cluster, false); check_control_data(&old_cluster.controldata, &new_cluster.controldata); /* Is it 9.0 but without tablespace directories? */ if (GET_MAJOR_VERSION(new_cluster.major_version) == 900 && new_cluster.controldata.cat_ver < TABLE_SPACE_SUBDIRS_CAT_VER) pg_log(PG_FATAL, "This utility can only upgrade to PostgreSQL version 9.0 after 2010-01-11\n" "because of backend API changes made during development.\n"); }
void check_cluster_compatibility(bool live_check) { /* get/check pg_control data of servers */ get_control_data(&old_cluster, live_check); get_control_data(&new_cluster, false); check_control_data(&old_cluster.controldata, &new_cluster.controldata); /* We read the real port number for PG >= 9.1 */ if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 && old_cluster.port == DEF_PGUPORT) pg_fatal("When checking a pre-PG 9.1 live old server, " "you must specify the old server's port number.\n"); if (live_check && old_cluster.port == new_cluster.port) pg_fatal("When checking a live server, " "the old and new port numbers must be different.\n"); }
void check_cluster_compatibility(bool live_check) { /* get/check pg_control data of servers */ get_control_data(&old_cluster, live_check); get_control_data(&new_cluster, false); check_control_data(&old_cluster.controldata, &new_cluster.controldata); /* Is it 9.0 but without tablespace directories? */ if (GET_MAJOR_VERSION(new_cluster.major_version) == 900 && new_cluster.controldata.cat_ver < TABLE_SPACE_SUBDIRS_CAT_VER) pg_fatal("This utility can only upgrade to PostgreSQL version 9.0 after 2010-01-11\n" "because of backend API changes made during development.\n"); /* We read the real port number for PG >= 9.1 */ if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 && old_cluster.port == DEF_PGUPORT) pg_fatal("When checking a pre-PG 9.1 live old server, " "you must specify the old server's port number.\n"); if (live_check && old_cluster.port == new_cluster.port) pg_fatal("When checking a live server, " "the old and new port numbers must be different.\n"); }
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { if(huart->Instance == USART2) { get_control_data(uart3_RX_data); } //// printf("\n len=%d \n\r", UART_RX_MAXLEN-rx_len); // Data_Receive_Anl(uart2_RX_data, UART_RX_MAXLEN-rx_len); //// uint16_t buff=0; //// printf("\n pData=%c%c\n\r", pData[0],pData[1]); //// printf("\n pData=%d%d\n\r", pData[0],pData[1]); // //// pData[0]-=48; //// pData[1]-=48; //// pData[2]-=48; //// PID_Roll_Struct.Kp = pData[0]*100+pData[1]*10+pData[2]; //// printf("\n PID_Roll_Struct=%f \n\r", PID_Roll_Struct.Kp); }
static int ldap_set_keytab(krb5_context krbctx, const char *ldap_uri, const char *principal_name, krb5_principal princ, const char *binddn, const char *bindpw, const char *mech, const char *ca_cert_file, struct keys_container *keys) { LDAP *ld = NULL; BerElement *sctrl = NULL; struct berval *control = NULL; LDAPControl **srvctrl = NULL; int ret; int kvno, i; ber_tag_t rtag; ber_int_t *encs = NULL; int successful_keys = 0; /* cant' return more than nkeys, sometimes less */ encs = calloc(keys->nkeys + 1, sizeof(ber_int_t)); if (!encs) { fprintf(stderr, _("Out of Memory!\n")); return 0; } /* build password change control */ control = create_key_control(keys, principal_name); if (!control) { fprintf(stderr, _("Failed to create control!\n")); goto error_out; } ret = ipa_ldap_bind(ldap_uri, princ, binddn, bindpw, mech, ca_cert_file, &ld); if (ret != LDAP_SUCCESS) { fprintf(stderr, _("Failed to bind to server!\n")); goto error_out; } /* perform password change */ ret = ipa_ldap_extended_op(ld, KEYTAB_SET_OID, control, &srvctrl); if (ret != LDAP_SUCCESS) { fprintf(stderr, _("Failed to get keytab!\n")); goto error_out; } ber_bvfree(control); control = NULL; sctrl = get_control_data(srvctrl, KEYTAB_RET_OID); if (!sctrl) { fprintf(stderr, _("ber_init() failed, Invalid control ?!\n")); goto error_out; } /* Format of response * * KeytabGetRequest ::= SEQUENCE { * new_kvno Int32 * SEQUENCE OF KeyTypes * } * * * List of accepted enctypes * * KeyTypes ::= SEQUENCE { * enctype Int32 * } */ rtag = ber_scanf(sctrl, "{i{", &kvno); if (rtag == LBER_ERROR) { fprintf(stderr, _("ber_scanf() failed, unable to find kvno ?!\n")); goto error_out; } for (i = 0; i < keys->nkeys; i++) { ret = ber_scanf(sctrl, "{i}", &encs[i]); if (ret == LBER_ERROR) { char enc[79]; /* fit std terminal or truncate */ krb5_error_code krberr; krberr = krb5_enctype_to_string( keys->ksdata[i].enctype, enc, 79); if (krberr) { fprintf(stderr, _("Failed to retrieve " "encryption type type #%d\n"), keys->ksdata[i].enctype); } else { fprintf(stderr, _("Failed to retrieve " "encryption type %1$s (#%2$d)\n"), enc, keys->ksdata[i].enctype); } } else { successful_keys++; } } if (successful_keys == 0) { fprintf(stderr, _("Failed to retrieve any keys")); goto error_out; } ret = filter_keys(krbctx, keys, encs); if (ret == 0) goto error_out; ber_free(sctrl, 1); ldap_controls_free(srvctrl); ldap_unbind_ext(ld, NULL, NULL); free(encs); return kvno; error_out: if (sctrl) ber_free(sctrl, 1); if (srvctrl) ldap_controls_free(srvctrl); if (ld) ldap_unbind_ext(ld, NULL, NULL); if (control) ber_bvfree(control); free(encs); return -1; }